锘??xml version="1.0" encoding="utf-8" standalone="yes"?>国产精品久久久久久av福利软件 ,国产精品一区二区免费福利视频,久久久噜噜噜久久http://www.aygfsteel.com/pear/category/16599.htmlzh-cnTue, 27 Feb 2007 17:47:35 GMTTue, 27 Feb 2007 17:47:35 GMT60閲嶆柊瀛︿範 Hibernate fetch lazy cascade inverse 鍏抽敭瀛?http://www.aygfsteel.com/pear/archive/2006/11/05/79251.htmlpearpearSun, 05 Nov 2006 12:04:00 GMThttp://www.aygfsteel.com/pear/archive/2006/11/05/79251.htmlhttp://www.aygfsteel.com/pear/comments/79251.htmlhttp://www.aygfsteel.com/pear/archive/2006/11/05/79251.html#Feedback0http://www.aygfsteel.com/pear/comments/commentRss/79251.htmlhttp://www.aygfsteel.com/pear/services/trackbacks/79251.htmlHibernate鏈璁╀漢澶村ぇ鐨勫氨鏄闆嗗悎鐨勫姞杞藉艦寮忋?br />涔︾湅浜哊嬈′簡錛岃繕鏄病鏈夌湡姝g悊瑙ibernate銆傛墍浠ヤ笅鍗堜笓闂ㄥ仛浜嗕笅嫻嬭瘯錛屽閰嶇疆鏂囦歡鐨勬剰鎬濆姞娣變簡璁よ瘑銆?br />
鍋囪鏈変袱涓〃錛孭hotos(涓錛壜?---聽 picture(澶氾級Photo鍖呭惈picture闆嗗悎

緇撹1錛?HQL浠g爜 > fetch錛堥厤緗級 > lazy 錛堥厤緗級
緇撹2錛?榛樿 lazy="true"
緇撹3錛?fetch 鍜?lazy 涓昏鏄敤鏉ョ駭鑱旀煡璇㈢殑錛屄犅?鑰?cascade 鍜?inverse 涓昏鏄敤鏉ョ駭鑱旀彃鍏ュ拰淇敼鐨?br />緇撹4錛?濡傛灉浣犳槸鐢╯pring鏉ュ府浣犵鐞嗕綘鐨剆ession, 騫朵笖鏄嚜鍔ㄦ彁浜わ紝寤惰繜鍔犺澆灝辯瓑浜庢病鍔犺澆~_~(褰撶劧
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 闄ら潪浣犳墜鍔ㄩ噸鏂版墦寮session鐒跺悗鎵嬪姩Hibernate.initialize(set);鐒跺悗鍏抽棴session.
緇撹5:聽聽聽聽聽cascade涓昏鏄畝鍖栦簡鍦ㄤ唬鐮佷腑鐨勭駭鑱旀洿鏂板拰鍒犻櫎銆?br />j緇撹6錛氳佺埜鍙互鏈夊涓瀛愶紝涓涓瀛愪笉鑳芥湁澶氫釜鑰佺埜錛岃屼笖鑰佺埜璇寸殑綆? 瀛╁瓙鍥寸潃鑰佺埜杞?br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽鎵浠hotos鑰佺埜瑕佹湁鏉冨姏鎵浠?cascade聽榪欎釜鍏抽敭瀛愰兘鏄佺粰鑰佺埜鐨勶紝聽涔熷氨鏄駭鑱旀洿鏂幫紝
聽聽聽聽聽聽聽聽聽聽聽聽聽聽 鑰佺埜鏀瑰浜嗭紝鍎垮瓙涔熷緱璺熺潃鏀癸紝鍛靛懙銆傗滀笉鐒訛紝灝辨病鏈夐浂鑺遍挶鍜濄?br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 鑰孭icture鍎垮瓙鏁翠綋鎸ㄩ獋錛屼絾鏄繕鏄緇存姢鐖跺瓙涔嬮棿鑹ソ鐨勫叧緋伙紝瀵硅佺埜鐧句緷鐧鵑『錛屾墍
聽聽聽聽聽聽聽聽聽聽聽聽聽聽 浠ヨ佺埜灝辮錛屽効瀛愶紝鈥滃叧緋伙紝鐢變綘鏉ョ淮鎶わ紙inverse="true")聽錛屼笉鐒跺氨涓嶇粰闆惰姳閽便傚懙銆傗濄?br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽 <set name="pictures" inverse="true" cascade="all">
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 <key>
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 <column name="photosid" not-null="true" />
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 </key>
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 <one-to-many class="girl.domain.Picture" />
聽聽聽聽聽聽聽聽 聽聽聽 </set>
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
嫻嬭瘯浠g爜錛?br />
聽聽聽Photos p = ps.getById(1);
聽聽Set<Picture> set = p.getPictures();
聽聽for(Picture pic : set){
聽 聽聽聽System.out.println(pic.getId());
聽聽}

聽 閰嶇疆鏂囦歡鐨勪竴閮ㄥ垎錛?br />聽聽聽聽聽聽 <set name="pictures" inverse="true" cascade="all" >
聽聽聽聽聽聽聽聽聽聽聽 <key>
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 <column name="photosid" not-null="true" />
聽聽聽聽聽聽聽聽聽聽聽 </key>
聽聽聽聽聽聽聽聽聽聽聽 <one-to-many class="girl.domain.Picture" />
聽聽聽聽聽聽聽 </set>

嫻嬭瘯榪囩▼浼氬閰嶇疆鏂囦歡涓嶆柇淇敼錛氬茍涓斾粠鏉ヤ笉鏇炬墜鍔ㄩ噸鏂版墦寮session

嫻嬭瘯緇撴瀯錛?br />
褰撻厤緗潯浠朵負 lazy=true 涓鍙ユ煡璇?嫻嬭瘯浠g爜涓病鏈夎皟鐢╣etPicture() 聽姝e父
Hibernate: select photos0_.id as id0_0_, photos0_.userid as userid0_0_, photos0_.typeid as typeid0_0_, photos0_.name as name0_0_, photos0_.createtime as createtime0_0_, photos0_.description as descript6_0_0_, photos0_.faceid as faceid0_0_, photos0_.uri as uri0_0_ from super.photos photos0_ where photos0_.id=?

lazy=true 涓鍙ユ煡璇?鏈塯etPicture()
Hibernate: select photos0_.id as id0_0_, photos0_.userid as userid0_0_, photos0_.typeid as typeid0_0_, photos0_.name as name0_0_, photos0_.createtime as createtime0_0_, photos0_.description as descript6_0_0_, photos0_.faceid as faceid0_0_, photos0_.uri as uri0_0_ from super.photos photos0_ where photos0_.id=?


lazy=true 涓鍙ユ煡璇⒙?鏈塯etPicture() 騫朵笖璁塊棶浜嗛噷闈㈢殑鍏冩暟Picture 涓旀湁寮傚父鎶涘嚭
Hibernate: select photos0_.id as id0_0_, photos0_.userid as userid0_0_, photos0_.typeid as typeid0_0_, photos0_.name as name0_0_, photos0_.createtime as createtime0_0_, photos0_.description as descript6_0_0_, photos0_.faceid as faceid0_0_, photos0_.uri as uri0_0_ from super.photos photos0_ where photos0_.id=?


lazy="false" 涓ゅ彞鏌ヨ聽 鑲畾娌¢棶棰橈紝鍥犱負鍏ㄩ儴鏁版嵁閮戒釜鏌ヤ簡鍑烘潵 鎵浠ユ庝箞璋冪敤閮芥甯?br />Hibernate: select photos0_.id as id0_0_, photos0_.userid as userid0_0_, photos0_.typeid as typeid0_0_, photos0_.name as name0_0_, photos0_.createtime as createtime0_0_, photos0_.description as descript6_0_0_, photos0_.faceid as faceid0_0_, photos0_.uri as uri0_0_ from super.photos photos0_ where photos0_.id=?
Hibernate: select pictures0_.photosid as photosid1_, pictures0_.id as id1_, pictures0_.id as id2_0_, pictures0_.photosid as photosid2_0_, pictures0_.name as name2_0_, pictures0_.clicked as clicked2_0_, pictures0_.uploaddate as uploaddate2_0_, pictures0_.size as size2_0_, pictures0_.description as descript7_2_0_, pictures0_.uri as uri2_0_ from super.picture pictures0_ where pictures0_.photosid=?


fetch="join"聽 涓鍙ユ煡璇⒙?鏁堟灉 錛濓紳 lazy="false" 鍛靛懙錛屽摢涓晥鐜囬珮錛屾垜灝變笉鐭ラ亾浜嗐傘傘傘傘傘傘傘傘傘傘?br />Hibernate: select photos0_.id as id0_1_, photos0_.userid as userid0_1_, photos0_.typeid as typeid0_1_, photos0_.name as name0_1_, photos0_.createtime as createtime0_1_, photos0_.description as descript6_0_1_, photos0_.faceid as faceid0_1_, photos0_.uri as uri0_1_, pictures1_.photosid as photosid3_, pictures1_.id as id3_, pictures1_.id as id2_0_, pictures1_.photosid as photosid2_0_, pictures1_.name as name2_0_, pictures1_.clicked as clicked2_0_, pictures1_.uploaddate as uploaddate2_0_, pictures1_.size as size2_0_, pictures1_.description as descript7_2_0_, pictures1_.uri as uri2_0_ from super.photos photos0_ left outer join super.picture pictures1_ on photos0_.id=pictures1_.photosid where photos0_.id=?

涓嶅姞fetch錛?join" 涓鍙ユ煡璇⒙?娌℃湁getPicture() 姝e父
Hibernate: select photos0_.id as id0_0_, photos0_.userid as userid0_0_, photos0_.typeid as typeid0_0_, photos0_.name as name0_0_, photos0_.createtime as createtime0_0_, photos0_.description as descript6_0_0_, photos0_.faceid as faceid0_0_, photos0_.uri as uri0_0_ from super.photos photos0_ where photos0_.id=?

涓嶅姞fetch錛?join" 涓鍙ユ煡璇⒙?鏈塯etPicture() 姝e父
Hibernate: select photos0_.id as id0_0_, photos0_.userid as userid0_0_, photos0_.typeid as typeid0_0_, photos0_.name as name0_0_, photos0_.createtime as createtime0_0_, photos0_.description as descript6_0_0_, photos0_.faceid as faceid0_0_, photos0_.uri as uri0_0_ from super.photos photos0_ where photos0_.id=?

涓嶅姞fetch錛?join" 涓鍙ユ煡璇?鏈塯etPicture() 騫朵笖璁塊棶閲岄潰鐨勫厓绱燩icture鐨処D 鏈夊紓甯告姏鍑?br />Hibernate: select photos0_.id as id0_0_, photos0_.userid as userid0_0_, photos0_.typeid as typeid0_0_, photos0_.name as name0_0_, photos0_.createtime as createtime0_0_, photos0_.description as descript6_0_0_, photos0_.faceid as faceid0_0_, photos0_.uri as uri0_0_ from super.photos photos0_ where photos0_.id=?

鏉ヤ釜涓ゅ叺浜ゆ垬 fetch="join" lazy="true"聽 鍛靛懙 緇撴灉錛屼竴鍙ユ煡璇紝 緇撴瀯姝e父 鎵浠ュ氨褰搇azy涓嶅瓨鍦ㄥソ浜嗐?鐪嬫潵fetch 鏄佸ぇ銆傘併併併併併併併併併併併併?br />Hibernate: select photos0_.id as id0_1_, photos0_.userid as userid0_1_, photos0_.typeid as typeid0_1_, photos0_.name as name0_1_, photos0_.createtime as createtime0_1_, photos0_.description as descript6_0_1_, photos0_.faceid as faceid0_1_, photos0_.uri as uri0_1_, pictures1_.photosid as photosid3_, pictures1_.id as id3_, pictures1_.id as id2_0_, pictures1_.photosid as photosid2_0_, pictures1_.name as name2_0_, pictures1_.clicked as clicked2_0_, pictures1_.uploaddate as uploaddate2_0_, pictures1_.size as size2_0_, pictures1_.description as descript7_2_0_, pictures1_.uri as uri2_0_ from super.photos photos0_ left outer join super.picture pictures1_ on photos0_.id=pictures1_.photosid where photos0_.id=?



pear 2006-11-05 20:04 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 陕西省| 墨玉县| 化德县| 咸阳市| 延边| 嵊泗县| 曲阜市| 锡林浩特市| 囊谦县| 梓潼县| 曲水县| 红安县| 海阳市| 如皋市| 杭锦后旗| 石泉县| 拉孜县| 晋宁县| 星子县| 白水县| 盐源县| 灌云县| 城口县| 大同市| 九寨沟县| 临汾市| 射阳县| 渝北区| 陇西县| 龙岩市| 禹城市| 夹江县| 黄平县| 安西县| 洮南市| 新巴尔虎右旗| 清苑县| 武乡县| 积石山| 托克逊县| 张家口市|