锘??xml version="1.0" encoding="utf-8" standalone="yes"?>国产中文字幕一区二区三区,一区二区激情小说,99这里只有久久精品视频http://www.aygfsteel.com/Werther/category/39066.htmlLive as if you were to die tomorrow. Learn as if you were to live forever. zh-cnWed, 24 Jun 2009 20:58:03 GMTWed, 24 Jun 2009 20:58:03 GMT60浼樺寲Hibernate鎬ц兘鐨勫嚑鐐瑰緩璁?/title><link>http://www.aygfsteel.com/Werther/archive/2009/06/24/283970.html</link><dc:creator>Werther</dc:creator><author>Werther</author><pubDate>Wed, 24 Jun 2009 09:08:00 GMT</pubDate><guid>http://www.aygfsteel.com/Werther/archive/2009/06/24/283970.html</guid><wfw:comment>http://www.aygfsteel.com/Werther/comments/283970.html</wfw:comment><comments>http://www.aygfsteel.com/Werther/archive/2009/06/24/283970.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/Werther/comments/commentRss/283970.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/Werther/services/trackbacks/283970.html</trackback:ping><description><![CDATA[     鎽樿: 閽堝Oracle鏁版嵁搴撹岃█錛孎etch Size 鏄瀹欽DBC鐨凷tatement璇誨彇鏁版嵁鐨勬椂鍊欐瘡嬈′粠鏁版嵁搴撲腑鍙栧嚭鐨勮褰曟潯鏁幫紝涓鑸緗負30銆?0銆?00.Oracle鏁版嵁搴撶殑JDBC椹卞姩榛樿鐨凢etch Size=15錛岃緗瓼etch Size璁劇疆涓猴細30銆?0錛屾ц兘浼氭湁鏄庢樉鎻愬崌錛屽鏋滅戶緇澶э紝瓚呭嚭100錛屾ц兘鎻愬崌涓嶆槑鏄撅紝鍙嶈屼細娑堣楀唴瀛樸?  <a href='http://www.aygfsteel.com/Werther/archive/2009/06/24/283970.html'>闃呰鍏ㄦ枃</a><img src ="http://www.aygfsteel.com/Werther/aggbug/283970.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/Werther/" target="_blank">Werther</a> 2009-06-24 17:08 <a href="http://www.aygfsteel.com/Werther/archive/2009/06/24/283970.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>Hibernate涓簩綰х紦瀛樼殑閰嶇疆鍜屼嬌鐢?http://www.aygfsteel.com/Werther/archive/2009/06/23/283789.htmlWertherWertherTue, 23 Jun 2009 09:32:00 GMThttp://www.aygfsteel.com/Werther/archive/2009/06/23/283789.htmlhttp://www.aygfsteel.com/Werther/comments/283789.htmlhttp://www.aygfsteel.com/Werther/archive/2009/06/23/283789.html#Feedback2http://www.aygfsteel.com/Werther/comments/commentRss/283789.htmlhttp://www.aygfsteel.com/Werther/services/trackbacks/283789.html(涓錛塇ibernate鐨勪簩綰х紦瀛樼瓥鐣ョ殑涓鑸繃紼嬪涓嬶細

1) 鏉′歡鏌ヨ鐨勬椂鍊欙紝鎬繪槸鍙戝嚭涓鏉elect * from table_name where …. 錛堥夋嫨鎵鏈夊瓧孌碉級榪欐牱鐨凷QL璇彞鏌ヨ鏁版嵁搴擄紝涓嬈¤幏寰楁墍鏈夌殑鏁版嵁瀵硅薄銆?

2) 鎶婅幏寰楃殑鎵鏈夋暟鎹璞℃牴鎹甀D鏀懼叆鍒扮浜岀駭緙撳瓨涓?

3) 褰揌ibernate鏍規嵁ID璁塊棶鏁版嵁瀵硅薄鐨勬椂鍊欙紝棣栧厛浠嶴ession涓綰х紦瀛樹腑鏌ワ紱鏌ヤ笉鍒幫紝濡傛灉閰嶇疆浜嗕簩綰х紦瀛橈紝閭d箞浠庝簩綰х紦瀛樹腑鏌ワ紱鏌ヤ笉鍒幫紝鍐嶆煡璇㈡暟鎹簱錛屾妸緇撴灉鎸夌収ID鏀懼叆鍒扮紦瀛樸?

4) 鍒犻櫎銆佹洿鏂般佸鍔犳暟鎹殑鏃跺欙紝鍚屾椂鏇存柊緙撳瓨銆?br />
Hibernate鐨勪簩綰х紦瀛樼瓥鐣ワ紝鏄拡瀵逛簬ID鏌ヨ鐨勭紦瀛樼瓥鐣ワ紝瀵逛簬鏉′歡鏌ヨ鍒欐鏃犱綔鐢ㄣ備負姝わ紝Hibernate鎻愪緵浜嗛拡瀵規潯浠舵煡璇㈢殑Query Cache銆?

錛堜簩錛変粈涔堟牱鐨勬暟鎹傚悎瀛樻斁鍒扮浜岀駭緙撳瓨涓紵

1 寰堝皯琚慨鏀圭殑鏁版嵁

2 涓嶆槸寰堥噸瑕佺殑鏁版嵁錛屽厑璁稿嚭鐜板伓灝斿茍鍙戠殑鏁版嵁

3 涓嶄細琚茍鍙戣闂殑鏁版嵁

4 鍙傝冩暟鎹?鎸囩殑鏄緵搴旂敤鍙傝冪殑甯擱噺鏁版嵁錛屽畠鐨勫疄渚嬫暟鐩湁闄愶紝瀹冪殑瀹炰緥浼氳璁稿鍏朵粬綾葷殑瀹炰緥寮曠敤錛屽疄渚嬫瀬灝戞垨鑰呬粠鏉ヤ笉浼氳淇敼銆?/p>

錛堜笁錛変笉閫傚悎瀛樻斁鍒扮浜岀駭緙撳瓨鐨勬暟鎹紵

1 緇忓父琚慨鏀圭殑鏁版嵁

2 璐㈠姟鏁版嵁錛岀粷瀵逛笉鍏佽鍑虹幇騫跺彂

3 涓庡叾浠栧簲鐢ㄥ叡浜殑鏁版嵁銆?

瀹炶返閮ㄥ垎錛?

浣跨敤EhCache閰嶇疆浜岀駭緙撳瓨錛?br />
閰嶇疆鍑嗗錛?br />
1)鎶奺hcache-1.2.3.jar鍔犲叆鍒板綋鍓嶅簲鐢ㄧ殑classpath涓?

2)鍦╤ibernate.cfg.xml鏂囦歡涓姞鍏hCache緙撳瓨鎻掍歡鐨勬彁渚涚被銆?

  1. <!--閰嶇疆緙撳瓨鎻掍歡 -->   
  2. <property name="hibernate.cache.provider_class">   
  3.     org.hibernate.cache.EhCacheProvider   
  4. </property>  

3)鎸庤礉ehcache.xml鏂囦歡鍒扮被璺緞(欏圭洰宸ョ▼鐨剆rc鐩綍涓?錛岃繖涓枃浠跺湪Hibernate瀹夎鐩綍鐨別tc涓嬨?br />
閰嶇疆姝ラ錛?br />
Hibernate鍏佽鍦ㄧ被鍜岄泦鍚堢殑綺掑害涓婅緗浜岀駭緙撳瓨銆傚湪鏄犲皠鏂囦歡涓紝<class>鍜?lt;set>鍏冪礌閮芥湁涓涓?lt;cache>瀛愬厓绱狅紝榪欎釜瀛愬厓绱犵敤鏉ラ厤緗簩綰х紦瀛樸?
紺轟緥錛氫互category(浜у搧綾誨埆)鍜宲roduct(浜у搧)鐨勬槧灝勪負渚嬶細

1) 淇敼瑕侀厤緗紦瀛樼殑閭d釜鎸佷箙鍖栫被鐨勫璞″叧緋繪槧灝勬枃浠訛細

Category.hbm.xml

<?xml version="1.0" encoding="utf-8"?>  

<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"  
" <hibernate-mapping>  
    <class name="org.qiujy.domain.cachedemo.Category" table="categories">  
       <!鈥?nbsp; 
             閰嶇疆緙撳瓨,蹇呴』绱ц窡鍦╟lass鍏冪礌鍚庨潰  
            瀵圭紦瀛樹腑鐨凜ategory瀵硅薄閲囩敤璇誨啓鍨嬬殑騫跺彂璁塊棶絳栫暐  
        -->  
       <cache usage="read-write"/>  
        
       <id name="id" type="java.lang.Long">  
           <column name="id" />  
           <generator class="native" />  
       </id>  
       <!-- 閰嶇疆鐗堟湰鍙?蹇呴』绱ц窡鍦╥d鍏冪礌鍚庨潰 -->  
       <version name="version" column="version" type="java.lang.Long" />  
        
       <property name="name" type="java.lang.String">  
           <column name="name" length="32" not-null="true"/>  
       </property>  
        
       <property name="description" type="java.lang.String">  
           <column name="description" length="255"/>  
       </property>  
        
       <set name="products" table="products" cascade="all" inverse="true">  
           <!-- Hibernate鍙細緙撳瓨瀵硅薄鐨勭畝鍗曞睘鎬х殑鍊?  
       瑕佺紦瀛橀泦鍚堝睘鎬?蹇呴』鍦ㄩ泦鍚堝厓绱犱腑涔熷姞鍏?lt;cache>瀛愬厓绱?nbsp; 
       鑰孒ibernate浠呬粎鏄妸涓庡綋鍓嶆寔涔呭璞″叧鑱旂殑瀵硅薄鐨凮ID瀛樻斁鍒扮紦瀛樹腑銆?nbsp; 
濡傛灉甯屾湜鎶婃暣涓叧鑱旂殑瀵硅薄鐨勬墍鏈夋暟鎹兘瀛樺叆緙撳瓨,  
鍒欒鍦ㄧ浉搴斿叧鑱旂殑瀵硅薄鐨勬槧灝勬枃浠朵腑閰嶇疆<cache>鍏冪礌  
           -->  
           <cache usage="read-write"/>  
            
           <key column="categoryId" not-null="true"/>  
           <one-to-many class="org.qiujy.domain.cachedemo.Product"/>  
       </set>  
        
    </class>  
</hibernate-mapping>

Product.hbm.xml

<?xml version="1.0" encoding="utf-8"?>  
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"  
" <hibernate-mapping>  
    <class name="org.qiujy.domain.cachedemo.Product" table="products">  
        
       <cache usage="read-write"/>  
        
       <id name="id" type="java.lang.Long">  
           <column name="id" />  
           <generator class="native" />  
       </id>  
       <!-- 閰嶇疆鐗堟湰鍙?蹇呴』绱ц窡鍦╥d鍏冪礌鍚庨潰 -->  
       <version name="version" column="version" type="java.lang.Long" />  
        
       <property name="name" type="java.lang.String">  
           <column name="name" length="32" not-null="true"/>  
       </property>  
        
       <property name="description" type="java.lang.String">  
           <column name="description" length="255"/>  
       </property>  
        
       <property name="unitCost" type="java.lang.Double">  
           <column name="unitCost" />  
       </property>  
        
       <property name="pubTime" type="java.util.Date">  
           <column name="pubTime" not-null="true" />  
       </property>  
        
       <many-to-one name="category"  
                column="categoryId"  
               class="org.qiujy.domain.cachedemo.Category"  
               cascade="save-update"  
                not-null="true">  
        </many-to-one>  
        
    </class>  
</hibernate-mapping>

2)緙栬緫ehcache.xml鏂囦歡錛?/p>

<ehcache>  
    <diskStore path="c:\\ehcache\"/>  
    <defaultCache  
        maxElementsInMemory="10000"  
        eternal="false"  
        timeToIdleSeconds="120"  
        timeToLiveSeconds="120"  
        overflowToDisk="true"    
        />  
         
    <!-- 璁劇疆Category綾葷殑緙撳瓨鐨勬暟鎹繃鏈熺瓥鐣?-->  
    <cache name="org.qiujy.domain.cachedemo.Category"  
        maxElementsInMemory="100"  
        eternal="true"  
        timeToIdleSeconds="0"  
        timeToLiveSeconds="0"  
        overflowToDisk="false"  
        />  
         
     <!-- 璁劇疆Category綾葷殑products闆嗗悎鐨勭紦瀛樼殑鏁版嵁榪囨湡絳栫暐 -->  
     <cache name="org.qiujy.domain.cachedemo.Category.products"  
        maxElementsInMemory="500"  
        eternal="false"  
        timeToIdleSeconds="300"  
        timeToLiveSeconds="600"  
        overflowToDisk="true"  
        />  
         
    <cache name="org.qiujy.domain.cachedemo.Product"  
        maxElementsInMemory="500"  
        eternal="false"  
        timeToIdleSeconds="300"  
        timeToLiveSeconds="600"  
        overflowToDisk="true"  
        />  
     
</ehcache>

鍦⊿pring鎵樼鐨凥ibernate涓嬌鐢ㄤ簩綰х紦瀛?1錛庡湪spring鐨勯厤緗枃浠朵腑錛宧ibernate閮ㄥ垎鍔犲叆 xml 浠g爜 org.hibernate.cache.EhCacheProvider true 2.涓篐BM琛ㄨ緗甤ache絳栫暐 xml 浠g爜 錛?鍦―AO涓紝璋冪敤find鏂規硶鏌ヨ涔嬪墠錛岃緗嬌鐢ㄧ紦瀛?Java浠g爜 getHibernateTemplate().setCacheQueries(true); 琛ュ厖錛?濡傛灉涓嶈緗?#8220;鏌ヨ緙撳瓨”錛岄偅涔坔ibernate鍙細緙撳瓨浣跨敤load()鏂規硶鑾峰緱鐨勫崟涓寔涔呭寲瀵硅薄錛屽鏋滄兂緙撳瓨浣跨敤findall()銆乴ist()銆両terator()銆乧reateCriteria()銆乧reateQuery()絳夋柟娉曡幏寰楃殑鏁版嵁緇撴灉闆嗙殑璇濓紝灝遍渶瑕佽緗?hibernate.cache.use_query_cache true 鎵嶈銆?/p>

Werther 2009-06-23 17:32 鍙戣〃璇勮
]]>
Hibernate鐨勪箰瑙傞攣涓庢偛瑙傞攣錛堣漿杞斤級 http://www.aygfsteel.com/Werther/archive/2009/06/22/283616.htmlWertherWertherMon, 22 Jun 2009 09:25:00 GMThttp://www.aygfsteel.com/Werther/archive/2009/06/22/283616.htmlhttp://www.aygfsteel.com/Werther/comments/283616.htmlhttp://www.aygfsteel.com/Werther/archive/2009/06/22/283616.html#Feedback0http://www.aygfsteel.com/Werther/comments/commentRss/283616.htmlhttp://www.aygfsteel.com/Werther/services/trackbacks/283616.html闃呰鍏ㄦ枃

Werther 2009-06-22 17:25 鍙戣〃璇勮
]]>
hibernate鐨?1澶т紭鍔?http://www.aygfsteel.com/Werther/archive/2009/06/18/283091.htmlWertherWertherThu, 18 Jun 2009 09:21:00 GMThttp://www.aygfsteel.com/Werther/archive/2009/06/18/283091.htmlhttp://www.aygfsteel.com/Werther/comments/283091.htmlhttp://www.aygfsteel.com/Werther/archive/2009/06/18/283091.html#Feedback14http://www.aygfsteel.com/Werther/comments/commentRss/283091.htmlhttp://www.aygfsteel.com/Werther/services/trackbacks/283091.html闃呰鍏ㄦ枃

Werther 2009-06-18 17:21 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 通州区| 浑源县| 乌兰浩特市| 湖口县| 瑞金市| 镶黄旗| 修文县| 綦江县| 静海县| 会东县| 文水县| 芜湖市| 荔波县| 黑山县| 鹤山市| 望谟县| 永靖县| 兰坪| 乌审旗| 尚志市| 凌海市| 太谷县| 彰化县| 正宁县| 正安县| 廉江市| 伊金霍洛旗| 类乌齐县| 宜良县| 平江县| 包头市| 札达县| 巩义市| 绍兴市| 汉中市| 宝山区| 苍溪县| 平罗县| 蒙城县| 新龙县| 神木县|