<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    VIRGIN FOREST OF JAVA
    不要埋頭苦干,要學(xué)習(xí),學(xué)習(xí),再學(xué)習(xí)。。。。。
    powered by R.Zeus

    From: Performance: Hibernate startup time

    The following tips hints how to make Hibernate startup faster.

    Only add the mapping files you need!

    If you are running some few JUnit tests for a 400++ classes project you probably don't hit every class in those tests and thus do not need to add all those hbm.xml's to the Configuration. Go look at Hibernate's test suite on how you could let your TestCase decide what classes should be defined in the mapping.

    Use serialized XML documents when configuring Configuration

    When building the configuration 40-60% of the time is used by the XML parsers and Dom4j to read up the XML document. Significant performance increases can be done by serializing the Document object's to disc once, and afterwards just add them to the configuration by deserializing them first.

    In the current cvs we have an experimental Configuration.addCachableFile() method that can be used as inspiration for previous Hibernate versions.

    public Configuration addCachableFile(String xmlFile) throws MappingException {        
            try {
                File file = new File(xmlFile);
                File lazyfile = new File(xmlFile + ".bin");
                org.dom4j.Document doc = null; 
                List errors = new ArrayList();
                if(file.exists() && lazyfile.exists() && file.lastModified()<lazyfile.lastModified()) {
                    log.info("Mapping lazy file: " + lazyfile.getPath());
                    ObjectInputStream oip = null;
                    oip = new ObjectInputStream(new FileInputStream(lazyfile));
                    doc = (org.dom4j.Document) oip.readObject();
                    oip.close(); 
                } else {
                    doc = xmlHelper.createSAXReader(xmlFile, errors, entityResolver).read( file );
                    log.info("Writing lazy file to " + lazyfile);
                    ObjectOutputStream oup = new ObjectOutputStream(new FileOutputStream(lazyfile));
                    oup.writeObject(doc);
                    oup.flush();
                    oup.close();
                }
                
                if ( errors.size()!=0 ) throw new MappingException( "invalid mapping", (Throwable) errors.get(0) );
                add(doc);
                return this;
            }
            catch (Exception e) {
                log.error("Could not configure datastore from file: " + xmlFile, e);
                throw new MappingException(e);
            }
        }
    

    Disable Hibernates usage of cglib reflection optimizer

    Put the following line in hibernate.properties:

    hibernate.cglib.use_reflection_optimizer=false
    

    It will make Hibernate start faster since it does not try to build cglib-enhanced objects to access getter/setters.

    Note: It will have in impact on overall runtime performance since Hibernate will be forced to use standard JDK reflection for access. So it is most useful during development. (You will also get better error messages in some situations when the optimizer is disabled ;)


    ? NEW?COMMENT

    Serializing the Configuration object
    04 May 2004, 12:37
    luish
    Another approach would be to serialize the whole Configuration 
    object. What do you think about this? I have submitted a patch to  
    the Jira to make the Configuration Serializable (see bugs 492 and 
    147).
    ?
    addLazyFile() not there.
    06 Jul 2004, 11:50
    gstamp
    I can't fine addLazyFile() in CVS.  Is it still supposed to be there?
    ?
    Hibernate3 feature
    31 Aug 2004, 11:13
    gavin
    Try the Hibernate3 module (or just the alpha release)
    ?
    Information update?
    30 Mar 2005, 07:54
    gruberc
    The information on this page does not seem to be correct any
    more. With Hibernate 3.0rc1, there is no Configuration.addLazyFile()
    any more, but addCacheableFile(). How should it be used?
    ?
    lazy
    06 Mar 2006, 05:09
    steckemetz
    If you have terrible problems with startup time and
    do NOT need certain features like:
    
    * proxy objects
    * lazy loading
    
    or if you are using the stateless session,
    then you can disable lazyness on class level like:
    
    <class name="myClass" table="myTable" lazy="false">
    
    The default is true and forces byte code generation of
    some proxy class which takes a lot of time.
    Perhaps some hibernate guru can tell us, which other
    features will be disabled by this.
    ?
    I solve it.
    02 Aug 2006, 00:12
    cm4ever
    The Hibernate Configuration module implement is very bad.
    I write a module to realize the dynamic loading mapping files.
    But other function I can't resolve...
    
    Hibernate Dynamic Module
    This project is only a module of Hibernate http://www.hibernate.org Read
    mapping file until insert/update/delete/select the persistent class in
    Hibernate.
    http://sourceforge.net/projects/hbn-dyn-mod/
    posted on 2006-10-30 17:22 R.Zeus 閱讀(882) 評論(0)  編輯  收藏 所屬分類: HibernateJ2SE
    主站蜘蛛池模板: 在线观看免费人成视频色9| 精品亚洲永久免费精品| 免费羞羞视频网站| 亚洲一卡2卡3卡4卡乱码 在线 | 免费无码又爽又刺激高潮软件| 亚洲Av无码国产情品久久 | 2019中文字幕免费电影在线播放| 亚洲AV无码乱码在线观看富二代| 亚洲网站在线观看| 香港a毛片免费观看| 久久亚洲AV无码精品色午夜| 91免费国产自产地址入| 亚洲中文无码av永久| 大学生一级特黄的免费大片视频| 风间由美在线亚洲一区| 亚洲AV无码乱码在线观看| 好猛好深好爽好硬免费视频| 久久亚洲综合色一区二区三区| 91香焦国产线观看看免费| 亚洲AV无码一区二区三区人| 日韩a级毛片免费观看| 成人免费视频一区二区| 亚洲国产精品嫩草影院在线观看 | 亚洲香蕉免费有线视频| 国产精品美女午夜爽爽爽免费 | 亚洲高清资源在线观看| 我要看免费的毛片| 羞羞漫画小舞被黄漫免费| 亚洲人成无码网站| 无码精品A∨在线观看免费| 美女免费精品高清毛片在线视| 亚洲乱码国产乱码精品精| 一个人免费观看www视频在线| 99亚洲男女激情在线观看| 中文字幕亚洲一区二区va在线| 9420免费高清在线视频| 亚洲国产成人AV在线播放 | 亚洲国产成人99精品激情在线| 成人亚洲网站www在线观看| 久久免费视频99| 校园亚洲春色另类小说合集|