锘??xml version="1.0" encoding="utf-8" standalone="yes"?>春暖花开亚洲性无区一区二区,久久精品视频亚洲,亚洲精品无码不卡在线播HEhttp://m.tkk7.com/mstar/category/1162.html鎼炶蔣浠跺紑鍙戝氨鍍忚寮哄ジ,濡傛灉涓嶈兘鍙嶆姉,灝變韓鍙楀畠鍚э紒zh-cnTue, 27 Feb 2007 18:33:49 GMTTue, 27 Feb 2007 18:33:49 GMT60Hibernate3涓彇寰楀灞傛暟鎹殑鎵浜х敓鐨刵+1 selects闂鐨勮В鍐熾?/title><link>http://m.tkk7.com/mstar/archive/2005/09/30/14477.html</link><dc:creator>榛戠伒</dc:creator><author>榛戠伒</author><pubDate>Fri, 30 Sep 2005 01:12:00 GMT</pubDate><guid>http://m.tkk7.com/mstar/archive/2005/09/30/14477.html</guid><wfw:comment>http://m.tkk7.com/mstar/comments/14477.html</wfw:comment><comments>http://m.tkk7.com/mstar/archive/2005/09/30/14477.html#Feedback</comments><slash:comments>6</slash:comments><wfw:commentRss>http://m.tkk7.com/mstar/comments/commentRss/14477.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/mstar/services/trackbacks/14477.html</trackback:ping><description><![CDATA[鍏跺疄榪欎釜闂鍦℉ibernate in Action涓凡緇忔湁寰堝縐嶈В鍐沖姙娉曚簡銆備絾鎴戣寰楀叾涓渶濂界殑鍔炴硶鏄敤Criteria鐨凢etchMode鏉ヨВ鍐籌紝浣嗘槸Hibernate in Action涓啓鐨勫緢涓嶈緇嗐傛垜鏄ㄦ櫄璇曚簡濂介暱鏃墮棿鏉ョ殑鍒扮瓟妗堛備笅闈㈡葷粨涓涓嬨?BR>闇姹傝繖鏍風殑錛屾垜鏈夊洓寮犺〃錛坥ne,two,three,four錛変粠one涓鐩村閿叧鑱斿埌four銆傜粨鏋勫涓?BR><IMG height=296 alt=hibernatefetch.jpg src="http://m.tkk7.com/images/blogjava_net/mstar/pics20050930/hibernatefetch.jpg" width=502 border=0><BR>鐜板湪鍦⊿ession涓緱鍒癘ne錛屽茍浠嶰ne閲屼竴鐩村彇鍒癋our閲岀殑鍐呭銆傚鏋滅畝鍗曠殑鐢⊿ession.get鏉ュ疄鐜版槸榪欐牱鐨勩?BR> <DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #000000">One one </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> (One)session.get(One.</SPAN><SPAN style="COLOR: #0000ff">class</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000"> Integer(</SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000">));<BR>        Iterator iterone </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> one.getTwos().iterator();<BR>        </SPAN><SPAN style="COLOR: #0000ff">while</SPAN><SPAN style="COLOR: #000000">(iterone.hasNext()){<BR>            Two two </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> (Two) iterone.next();<BR>            Iterator itertwo </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> two.getThrees().iterator();<BR>            </SPAN><SPAN style="COLOR: #0000ff">while</SPAN><SPAN style="COLOR: #000000">(itertwo.hasNext()){<BR>                Three three </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> (Three) itertwo.next();<BR>                three.getFours().size();                <BR>            }<BR>        }</SPAN></DIV>榪欐牱鎴戝湪Session鍏抽棴鍚庤繑鍥炵殑One閲屾槸浠嶰ne鍒癋our鐨勪俊鎭兘鏈夌殑銆?BR>鐒惰岃繖鏍峰仛鎵瀵艱嚧鐨勭粨鏋滄槸鐢熸垚澶ч噺鐨凷QL鏌ヨ錛岃繖鏄竴涓吀鍨嬬殑n+1 Selects闂銆傚鏋滅郴緇熺粨鏋勫眰嬈″錛岀鍚堟潯浠剁殑璁板綍澶氾紝閭d箞Hibernate涓轟綘鐢熸垚鐨凷QL鏌ヨ灝嗘槸闅句互鎺ュ彈鐨勩?BR>瀵逛簬榪欎釜渚嬪瓙鐢熸垚鐨凷QL鏄繖鏍風殑<BR>Hibernate: select one0_.c_one_id as c1_0_, one0_.c_one_text as c2_3_0_ from One one0_ where one0_.c_one_id=?<BR>Hibernate: select twos0_.c_one_id as c2_1_, twos0_.c_two_id as c1_1_, twos0_.c_two_id as c1_0_, twos0_.c_one_id as c2_2_0_, twos0_.c_two_text as c3_2_0_ from Two twos0_ where twos0_.c_one_id=?<BR>Hibernate: select threes0_.c_two_id as c2_1_, threes0_.c_three_id as c1_1_, threes0_.c_three_id as c1_0_, threes0_.c_two_id as c2_1_0_, threes0_.c_three_text as c3_1_0_ from Three threes0_ where threes0_.c_two_id=?<BR>Hibernate: select fours0_.c_three_id as c2_1_, fours0_.c_four_id as c1_1_, fours0_.c_four_id as c1_0_, fours0_.c_three_id as c2_0_0_, fours0_.c_four_text as c3_0_0_ from Four fours0_ where fours0_.c_three_id=?<BR>Hibernate: select fours0_.c_three_id as c2_1_, fours0_.c_four_id as c1_1_, fours0_.c_four_id as c1_0_, fours0_.c_three_id as c2_0_0_, fours0_.c_four_text as c3_0_0_ from Four fours0_ where fours0_.c_three_id=?<BR>Hibernate: select threes0_.c_two_id as c2_1_, threes0_.c_three_id as c1_1_, threes0_.c_three_id as c1_0_, threes0_.c_two_id as c2_1_0_, threes0_.c_three_text as c3_1_0_ from Three threes0_ where threes0_.c_two_id=?<BR>Hibernate: select fours0_.c_three_id as c2_1_, fours0_.c_four_id as c1_1_, fours0_.c_four_id as c1_0_, fours0_.c_three_id as c2_0_0_, fours0_.c_four_text as c3_0_0_ from Four fours0_ where fours0_.c_three_id=?<BR>Hibernate: select fours0_.c_three_id as c2_1_, fours0_.c_four_id as c1_1_, fours0_.c_four_id as c1_0_, fours0_.c_three_id as c2_0_0_, fours0_.c_four_text as c3_0_0_ from Four fours0_ where fours0_.c_three_id=?<BR>瀵逛簬榪欐牱鐨勯棶棰橈紝鍦ㄦ病鏈塇ibernate浠ュ墠鎴戜滑涓鑸兘鐢╦dbc鏉ュ仛錛岄偅鏍風殑璇濇垜浠叾瀹炵敤涓涓繘琛?嬈oin鐨剆ql璇彞灝卞彲浠ュ疄鐜幫紝浣嗘槸榪欐牱瑙e喅涔熸湁闂錛屽氨鏄繑鍥炵殑ResultSet涓殑鏁版嵁闈炲父澶氾紝鑰屼笖鏉備貢錛屽叾瀹炴槸浠巓ne鍒癴our騫寵鎺掑垪鐨勩傚浜庤繖鏍風殑緇撴灉闆嗘垜浠鎶婂畠鎵嬪姩褰卞皠鏇懼璞$粨鏋勪篃鏄竴涓緢澶嶆潅鐨勬搷浣溿?BR>騫稿ソHibernate3鍙互涓烘垜浠仛榪欎簺浜嬫儏(鎴戝啀涓嬈¤Hibernate鐨勫己澶ф墍闇囨捈)銆?BR>涓婇潰鐨勫疄鐜板彲浠ョ敤Criteria鏉ュ疄鐜幫細<BR> <DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #000000">session </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> sessionFactory.openSession();<BR>        Criteria criteria </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> session.createCriteria(One.</SPAN><SPAN style="COLOR: #0000ff">class</SPAN><SPAN style="COLOR: #000000">);<BR>        criteria.add(Expression.eq(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">COneId</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000"> Integer(</SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000">)));<BR>        one </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> (One)criteria.setFetchMode(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">twos</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,FetchMode.JOIN).setFetchMode(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">twos.threes</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,FetchMode.JOIN).setFetchMode(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">twos.threes.fours</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,FetchMode.JOIN).uniqueResult();<BR>        session.close();</SPAN></DIV> <P>榪欓噷鐨勯噸鐐規槸榪欏彞璇漜riteria.setFetchMode(<SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">twos</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,FetchMode.JOIN).setFetchMode(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">twos.threes</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,FetchMode.JOIN).setFetchMode(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">twos.threes.fours</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,FetchMode.JOIN).uniqueResult();<BR>鍦ㄧ敤Criteria涔嬪墠鍏堣緗瓼etchMode錛屽簲涓篊riteria鏄姩鎬佺敓鎴恠ql璇彞鐨勶紝鎵浠ョ敓鎴愮殑sql灝辨槸涓灞傚眰Join涓嬪幓鐨勩?BR>setFetchMode錛圫tring錛孧ode錛夌涓涓弬鏁版槸association path錛岀敤"."鏉ヨ〃紺鴻礬寰勩傝繖涓鐐瑰叿浣撶殑渚嬪瓙寰堝皯錛屾枃妗d篃娌℃湁鍐欐竻妤氥傛垜涔熸槸璇曚簡寰堜箙鎵嶈瘯鍑烘潵鐨勩?BR>灝辮繖涓緥瀛愭潵鎵鎶婂洜涓哄彇閬撶鍥涘眰錛屾墍浠ヨ榪涜涓夋setFetchMode<BR>絎竴嬈$殑璺緞鏄痶wos錛屼竴浣峯ne涓湁two鐨凷et銆傝繖涓叿浣撹鏇村叿hbm.xml鐨勯厤緗潵瀹氥?BR>絎簩涓礬寰勫氨鏄痶wos.threes<BR>絎笁涓氨鏄痶wos.threes.fours<BR>涓嬈$被鎺紝涓灞傚眰澧炲姞鐨勩?BR>榪欐牱鍋氭硶鏈緇堢敓鎴愮殑SQL鏄繖鏍風殑錛?BR>Hibernate: select this_.c_one_id as c1_3_, this_.c_one_text as c2_3_3_, twos2_.c_one_id as c2_5_, twos2_.c_two_id as c1_5_, twos2_.c_two_id as c1_0_, twos2_.c_one_id as c2_2_0_, twos2_.c_two_text as c3_2_0_, threes3_.c_two_id as c2_6_, threes3_.c_three_id as c1_6_, threes3_.c_three_id as c1_1_, threes3_.c_two_id as c2_1_1_, threes3_.c_three_text as c3_1_1_, fours4_.c_three_id as c2_7_, fours4_.c_four_id as c1_7_, fours4_.c_four_id as c1_2_, fours4_.c_three_id as c2_0_2_, fours4_.c_four_text as c3_0_2_ from One this_ left outer join Two twos2_ on this_.c_one_id=twos2_.c_one_id left outer join Three threes3_ on twos2_.c_two_id=threes3_.c_two_id left outer join Four fours4_ on threes3_.c_three_id=fours4_.c_three_id where this_.c_one_id=?<BR>铏界劧寰堥暱浣嗘槸鍙湁涓鏉QL璇彞銆傛ц兘瑕佸ソ寰堝銆侶ibernate鐨勫己澶т箣澶勬槸瀹冧細鎶婅繑鍥炵殑ResultSet鑷姩褰卞皠鍒頒綘鐨勫璞℃ā鍨嬮噷闈㈠幓銆傝繖灝變負鎴戜滑鐪佷簡寰堝浜嬨?BR><BR>鐪嬫潵Hibernate鐪熸槸涓涓愪漢瀵誨懗鐨凢ramework鍟娿?BR></SPAN><SPAN style="COLOR: #000000"><BR>婧愮爜錛屾病浠涔堜笢瑗褲?BR><A href="http://m.tkk7.com/mstar/Files/mstar/HiberFetch2.rar">http://m.tkk7.com/Files/mstar/HiberFetch2.rar</A></P></SPAN><img src ="http://m.tkk7.com/mstar/aggbug/14477.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/mstar/" target="_blank">榛戠伒</a> 2005-09-30 09:12 <a href="http://m.tkk7.com/mstar/archive/2005/09/30/14477.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>Hibernate3涓殑鏇存柊涓庡垹闄?/title><link>http://m.tkk7.com/mstar/archive/2005/09/15/13130.html</link><dc:creator>榛戠伒</dc:creator><author>榛戠伒</author><pubDate>Thu, 15 Sep 2005 15:52:00 GMT</pubDate><guid>http://m.tkk7.com/mstar/archive/2005/09/15/13130.html</guid><wfw:comment>http://m.tkk7.com/mstar/comments/13130.html</wfw:comment><comments>http://m.tkk7.com/mstar/archive/2005/09/15/13130.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/mstar/comments/commentRss/13130.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/mstar/services/trackbacks/13130.html</trackback:ping><description><![CDATA[鍦℉ibernate2涓鏌愪釜琛ㄨ繘琛屾洿鏂板拰鍒犻櫎錛屽繀欏誨厛鎶婂畠Load鍑烘潵錛屽湪鍚庢洿鏀癸紝鐒跺悗鍐嶄繚瀛樸?BR>榪欎釜榪囩▼瀵逛簬鎵歸噺鎿嶄綔鎴栬呭浜庤〃鍏崇郴姣旇緝澶嶆潅鐨勬儏鍐碉紝鏄緢澶嶆潅鐨勩?BR>鍦℉ibernate3涓璈QL璇彞涓凡緇忔敮鎸乽pdate 鍜宒elete 浜?BR>浣嗘槸瑕佹敞鎰忕殑鏄痷pdate鍜宒elete鐨凥QL涓嶆槸闈㈠悜瀵硅薄鐨勪簡銆備綘鐢ㄥ璞℃柟寮忕殑璇彞榪斿洖浼氬嚭閿欍?BR>涓嬮潰鏄竴涓畝鍗曠殑渚嬪瓙銆?BR>鐢ㄥ璞$殑鏂瑰紡錛屼笉鐢℉QL錛?BR> <DIV style="BORDER-RIGHT: #000 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #000 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #000 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #000 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #000000">        Session session </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> getSession();<BR>        Customer host </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> (Customer) session.load(Customer.</SPAN><SPAN style="COLOR: #0000ff">class</SPAN><SPAN style="COLOR: #000000">,hostEmail);<BR>        Customer guest </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> (Customer)session.load(Customer.</SPAN><SPAN style="COLOR: #0000ff">class</SPAN><SPAN style="COLOR: #000000">,guestEmail);<BR>        ContactId id</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000"> ContactId(host,guest);<BR>        Contact contact </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> (Contact)<FONT size=3>session</FONT>.load(Contact.</SPAN><SPAN style="COLOR: #0000ff">class</SPAN><SPAN style="COLOR: #000000">,id);<BR>        RelationShip relation </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> (RelationShip)session.load(RelationShip.</SPAN><SPAN style="COLOR: #0000ff">class</SPAN><SPAN style="COLOR: #000000">, </SPAN><SPAN style="COLOR: #000000">2</SPAN><SPAN style="COLOR: #000000">);<BR>        contact.setRelationShip(relation);<BR>        contact.setUpdateTime(Calendar.getInstance().getTime());<BR>        session.flush();<BR>        session.close();</SPAN></DIV>鐢℉QL錛?BR> <DIV style="BORDER-RIGHT: #000 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #000 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #000 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #000 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #000000">        </SPAN><SPAN style="COLOR: #0000ff">private</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">static</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">final</SPAN><SPAN style="COLOR: #000000"> String HQL_BADGUY_TO_FRIEND </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">update Contact set relation_id = 1, updateTime = :updateTime where host = :hostEmail and guest = :guestEmail</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR><BR>        Session session </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> getSession();<BR>        Query query </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> session.createQuery(HQL_BADGUY_TO_FRIEND);<BR>        query.setString(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">hostEmail</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,hostEmail);<BR>        query.setString(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">guestEmail</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,guestEmail);<BR>        query.setDate(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">updateTime</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,Calendar.getInstance().getTime());<BR>        query.executeUpdate();<BR>        session.close();</SPAN></DIV>濡傛灉浣犳妸HQL鍐欐垚榪欎釜鏍峰瓙錛?BR>update Contact as c set c.relationShip.relationId =1 ......<BR>鍙嶈屼細鍑洪敊錛屼篃灝辨槸璇達紝浣犲氨鎸夌収native SQL鍘誨啓灝辮浜嗐?BR>榪樻湁錛屽鏋滆兘浣跨敤榪欐牱鐨勫姛鑳?BR><STRONG>hibernate.query.factory_class  =  org.hibernate.hql.classic.ClassicQueryTranslatorFactory</STRONG><BR>榪欎釜Hibernate閰嶇疆灞炴ц涓嶅幓鎺夛紝瑕佷笉鎹㈡垚<STRONG>org.hibernate.hql.ast.ASTQueryTranslatorFactory</STRONG><BR>涓婇潰閭d釜鏄敮鎸丠ibernate2鐨勩?BR>浣嗘槸鏈変竴鐐硅娉ㄦ剰錛屽鏋滀綘鐢╱pdate璇彞鏉ュ仛鐨勮瘽錛屽彲鑳戒駭鐢熺紦瀛樺悓姝ラ棶棰橈紝鑰屼笖涓ょ鏂規硶鏈鍚嶩ibernate鎵ц鐨勮鍙ュ樊涓嶅錛屽浜庣涓縐嶆柟娉旽ibernate涔熸槸灝辯敓鎴愪竴鏉pdate璇彞錛屽綋鐒跺洜涓烘垜鏄牴鎹富閿潵update鐨勶紝濡傛灉鎵歸噺澶勭悊鐨勮瘽榪樻槸鐢║pdate HQL蹇?BR><img src ="http://m.tkk7.com/mstar/aggbug/13130.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/mstar/" target="_blank">榛戠伒</a> 2005-09-15 23:52 <a href="http://m.tkk7.com/mstar/archive/2005/09/15/13130.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>Could not initialize proxy - the owning Session was closedhttp://m.tkk7.com/mstar/archive/2005/09/05/12125.html榛戠伒榛戠伒Mon, 05 Sep 2005 15:57:00 GMThttp://m.tkk7.com/mstar/archive/2005/09/05/12125.htmlhttp://m.tkk7.com/mstar/comments/12125.htmlhttp://m.tkk7.com/mstar/archive/2005/09/05/12125.html#Feedback1http://m.tkk7.com/mstar/comments/commentRss/12125.htmlhttp://m.tkk7.com/mstar/services/trackbacks/12125.htmlHibernate綾葷殑initialize()闈欐佹柟娉曠敤浜庡湪Session鑼冨洿鍐呮樉寮忓垵濮嬪寲浠g悊綾誨疄渚嬶紝isInitialized()鏂規硶鐢ㄤ簬鍒ゆ柇浠g悊綾誨疄渚嬫槸鍚﹀凡緇忚鍒濆鍖栥備緥濡傦細

tx = session.beginTransaction();
Customer customer=(Customer)session.load(Customer.class,new Long(1));
if(!Hibernate.isInitialized(customer))
Hibernate.initialize(customer);
tx.commit();
session.close();
customer.getName();

浠ヤ笂浠g爜鍦⊿ession鑼冨洿鍐呴氳繃Hibernate綾葷殑initialize()鏂規硶鏄懼紡鍒濆鍖栦簡Customer浠g悊綾誨疄渚嬶紝鍥犳褰揝ession鍏抽棴鍚庯紝鍙互姝e父璁塊棶Customer娓哥瀵硅薄銆?/FONT>



榛戠伒 2005-09-05 23:57 鍙戣〃璇勮
]]>
iBatis瀹炴垬灝忕粨錛?/title><link>http://m.tkk7.com/mstar/archive/2005/08/23/10790.html</link><dc:creator>榛戠伒</dc:creator><author>榛戠伒</author><pubDate>Tue, 23 Aug 2005 05:59:00 GMT</pubDate><guid>http://m.tkk7.com/mstar/archive/2005/08/23/10790.html</guid><wfw:comment>http://m.tkk7.com/mstar/comments/10790.html</wfw:comment><comments>http://m.tkk7.com/mstar/archive/2005/08/23/10790.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/mstar/comments/commentRss/10790.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/mstar/services/trackbacks/10790.html</trackback:ping><description><![CDATA[<P><FONT color=#000000>澶翠竴嬈″湪欏圭洰涓敤iBatis錛屼互鍓嶇敤榪嘓ibernate鎵浠ユ帴鍙楄搗鏉ユ瘮杈冨揩錛屼絾鏄痠Batis鍜孒ibernate鍦ㄧ粏鑺備笂榪樻槸鏈夊緢澶氫笉鍚屼箣澶勭殑銆?BR>鍦ㄨ繖綃囨枃绔犻噷錛屾垜涓昏鎬葷粨iBatis涓竴浜涘鏄撲駭鐢熻帿鍚嶅叾濡欑殑閿欒鐨勫湴鏂廣?BR>涓銆?BR>      iBatis浼氬浣犲啓鍦▁ml涓殑sql璇彞榪涜浼樺寲銆傚畠涓嶆槸鍌誨偦鐨勬寜鐓т綘鍐欑殑涓滆タ鍘熷皝涓嶅姩鐨勬墽琛屻傚湪榪欓噷鎴戠洰鍓嶅彧鍙戠幇浜嗕竴鐐瑰浜庝綘鐨剅esultClass涓病鏈夌殑灞炴э紝鍗充究鏄綘鍐欏湪select璇彞涓湁榪欎釜灞炴э紝瀹冨湪鎵ц鐨勫疄鐜頒篃浼氬幓鎺夈傝繑鍥炵殑ResultSet涓槸娌℃湁鐨勩?BR>浜屻?BR>      鍐欏湪sql-map-config.xml閲岄潰鐨勯偅浜泂qlMap鐨勯『搴忎笉鏄殢渚挎庝箞鏍烽兘鍙互鐨勩傚浜庣殑A-sqlMap瑕佺敤鍒癇-sqlMap涓畾涔夌殑涓滆タ鐨勬椂鍊欙紝A涓瀹氳鍐欏湪B鍓嶉潰銆備笉鐒朵細鎶ラ敊錛岃浣燘涓湁浜涗粈涔堜笢瑗挎壘涓嶅埌瀹氫箟銆?BR>涓夈?BR><insert id="..." parameterClass="..."><BR>       <selectKey resultClass="..." keyProperty="..." > <BR>         select ....<BR>       </selectKey> <BR>         .....<BR>         .....<BR></insert><BR>榪欐槸涓誨姩鐢熸垚涓婚敭緙栧彿騫舵墽琛屾彃鍏ョ殑鏂規硶銆傚湪浣跨敤榪欎釜鏂規硶鐨勬椂鍊欙紝浣犵殑parameterClass涓竴瀹氳鏈変笌keyProperty瀵瑰簲鐨勫睘鎬э紝榪欐牱ibatis浼氭妸select鍑烘潵鐨勭紪鍙鋒斁鍥瀙arameterClass涓紝鐒跺悗鍐嶆墽琛宨nsert鎿嶄綔銆?BR>鍥涖?BR>      sqlMap涓殑瀹氫箟鏄叏灞鐨勶紝灝介噺涓嶈鍑虹幇閲嶅鐨勫畾涔夛紝濡倀ypeAlias錛宻ql-id絳夌瓑銆?/FONT></P><img src ="http://m.tkk7.com/mstar/aggbug/10790.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/mstar/" target="_blank">榛戠伒</a> 2005-08-23 13:59 <a href="http://m.tkk7.com/mstar/archive/2005/08/23/10790.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>涓涓洶鎵頒簡鎴戝ソ鍑犲ぉ鐨凥ibernate+Spring鐨勯棶棰橈紝綆楁槸瑙e喅浜嗗惂錛?/title><link>http://m.tkk7.com/mstar/archive/2005/06/02/5485.html</link><dc:creator>榛戠伒</dc:creator><author>榛戠伒</author><pubDate>Thu, 02 Jun 2005 13:32:00 GMT</pubDate><guid>http://m.tkk7.com/mstar/archive/2005/06/02/5485.html</guid><wfw:comment>http://m.tkk7.com/mstar/comments/5485.html</wfw:comment><comments>http://m.tkk7.com/mstar/archive/2005/06/02/5485.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://m.tkk7.com/mstar/comments/commentRss/5485.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/mstar/services/trackbacks/5485.html</trackback:ping><description><![CDATA[String hql = "from TradeRecord as tr where tr.TradeTime>= :startTime and tr.TradeTime <= :endTime and tr.CustomerId =:cid";<BR>  String[] params = { "startTime", "endTime", "cid" };<BR>  Object[] args = { startTime, endTime, new Long(cid) };<BR> List list= this.getHibernateTemplate().findByNamedParam(hql,params,args);<BR>榪欐槸浣犺皟鐢╨ist涓殑瀵硅薄鐨刧et鏂規硶錛屽鏋滆繖涓猤et鏂規硶闇瑕乴azy load錛屼綘灝嗙湅鍒板涓嬪紓甯革細<BR> ERROR LazyInitializationException:19 - could not initialize proxy - the owning Session was closed<BR><BR>榪欎釜闂鍥版壈鐨勬垜閮借璺蟲ゼ浜嗐?BR><BR>鐜板湪榪欐牱灝卞彲浠ヤ簡錛?BR>Session session = this.getSession();<BR>  String hql = "from TradeRecord as tr where tr.TradeTime>= :startTime "<BR>    + "and tr.TradeTime <= :endTime and tr.CustomerId =:cid";<BR>  String[] params = { "startTime", "endTime", "cid" };<BR>  Object[] args = { startTime, endTime, new Long(cid) };<BR>  Query query = session.createQuery(hql);<BR>  query.setDate("startTime",startTime);<BR>  query.setDate("endTime",endTime);<BR>  query.setLong("cid", cid);<BR>  List list = query.list();<BR><BR>涔熷氨鏄錛岃皟鐢℉ibernateTemplate鐨刦indByNamedParam鏂規硶錛屼粬鍦ㄦ墽琛屽畬浠ュ悗浼氭妸session鑷姩鍏蟲帀銆?BR><BR>鎴戠幇鍦ㄥ湪鎵炬簮鐮佺湅涓┒绔熴?BR><BR>榪欎釜闂铏界劧瑙e喅浜嗭紝浣嗘槸騫朵笉鍊煎緱楂樺叴錛屽洜涓烘垜鍙戠幇hibernate鎵ц鐨凷QL璇彞瑕佹瘮鎴戠敤JDBC鍐欑殑sql璇彞澶氬緢澶氥傛垜寰堟鐤慼ibernate鐨勬晥鐜囥?img src ="http://m.tkk7.com/mstar/aggbug/5485.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/mstar/" target="_blank">榛戠伒</a> 2005-06-02 21:32 <a href="http://m.tkk7.com/mstar/archive/2005/06/02/5485.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>瀵逛簬鏄ㄥぉUser -- Friend鍏崇郴鐨勮В鍐籌紒http://m.tkk7.com/mstar/archive/2005/04/28/3888.html榛戠伒榛戠伒Thu, 28 Apr 2005 06:00:00 GMThttp://m.tkk7.com/mstar/archive/2005/04/28/3888.htmlhttp://m.tkk7.com/mstar/comments/3888.htmlhttp://m.tkk7.com/mstar/archive/2005/04/28/3888.html#Feedback0http://m.tkk7.com/mstar/comments/commentRss/3888.htmlhttp://m.tkk7.com/mstar/services/trackbacks/3888.html闃呰鍏ㄦ枃

榛戠伒 2005-04-28 14:00 鍙戣〃璇勮
]]>
榪欐牱鐨勮〃緇撴瀯Hibernate鏄犲皠搴旇鏄粈涔堟牱瀛愶紵 http://m.tkk7.com/mstar/archive/2005/04/27/3869.html榛戠伒榛戠伒Wed, 27 Apr 2005 14:33:00 GMThttp://m.tkk7.com/mstar/archive/2005/04/27/3869.htmlhttp://m.tkk7.com/mstar/comments/3869.htmlhttp://m.tkk7.com/mstar/archive/2005/04/27/3869.html#Feedback1http://m.tkk7.com/mstar/comments/commentRss/3869.htmlhttp://m.tkk7.com/mstar/services/trackbacks/3869.html涓涓猆ser琛ㄥ瓨鏀劇敤鎴蜂俊鎭紝涓涓ソ鍙嬭〃瀛樻斁濂藉弸鍏崇郴銆?BR>濂藉弸琛ㄦ湁涓や釜瀛楁錛屼竴涓槸host錛屼竴涓槸friend錛岃繖涓や釜瀛楁閮芥槸User琛ㄤ腑userid鐨勫閿?/P>

鎴戝湪鐢ㄥ伐鍏風敓鎴愪唬鐮佹椂鎬繪槸鏈夐棶棰樸傚嚑涔庢墍鏈夊伐鍏烽兘璇曡繃浜嗭紝鎵浠ユ垜鍐沖畾鑷繁鍐欍備絾鎴戜篃鏄庣櫧璇ユ庝箞鍐欙紵鏄笉鏄繖涓ソ鍙嬭〃涓嶅簲璇ユ湁鏄犲皠鏂囦歡鍜宩ava綾誨晩錛熷鏋滄槸錛岄偅涔堝湪User琛ㄤ腑鐨勬槧灝勬枃浠跺簲璇ユ庝箞鍐欏憿錛?BR>



榛戠伒 2005-04-27 22:33 鍙戣〃璇勮
]]>
Hibernate鐢∕ysql鐨勪腑鏂囬棶棰?/title><link>http://m.tkk7.com/mstar/archive/2005/04/27/3849.html</link><dc:creator>榛戠伒</dc:creator><author>榛戠伒</author><pubDate>Wed, 27 Apr 2005 07:48:00 GMT</pubDate><guid>http://m.tkk7.com/mstar/archive/2005/04/27/3849.html</guid><wfw:comment>http://m.tkk7.com/mstar/comments/3849.html</wfw:comment><comments>http://m.tkk7.com/mstar/archive/2005/04/27/3849.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/mstar/comments/commentRss/3849.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/mstar/services/trackbacks/3849.html</trackback:ping><description><![CDATA[<P>hibernate.cfg.xml鍦?lt;session-factory>鍜?lt;/session-factory>涔嬮棿鍔犲叆榪欎箞涓孌碉細 <BR>        <property name="connection.useUnicode">true</property> <BR>        <property name="connection.characterEncoding">UTF-8</property><BR><BR>榪欐牱涓鏉ワ紝鏄彲浠ヨВ鍐充貢鐮侀棶棰樸?BR>浣嗘槸濡傛灉浣犵敤涓浜涙暟鎹簱綆$悊鍣紝鐪嬭鐨勪腑鏂囨暟鎹兘鏄貢鐮侊紒鍥犱負瀹冨瓨榪涘幓鐨勬槸Unicode<BR>涔熷氨鏄錛屽湪榪欑瑙e喅鏂規硶涓嬬殑MySQL涓殑鏁版嵁鍙兘閽堝Hibernate浣跨敤錛屽鏋滆繖涓暟鎹簱騫墮潪鍙拡瀵笻ibernate鑰岃璁★紝榪樻湁鍏朵粬鐨勭郴緇熷湪鐢ㄨ繖榪欎釜鏁版嵁搴擄紝鐢氳嚦鏈夊彲鑳借繖涓郴緇熼兘涓嶆槸浣跨敤java緙栧啓鐨勩傞偅涔堣繖涓郴緇熸墍鑳界湅瑙佺殑鍙湁涔辯爜浜嗐?BR><BR>鏈夋病鏈夋洿濂界殑瑙e喅鏂規硶鍛紵<BR><BR>鎴戣兘鎯沖埌鐨勫氨鏄笉鐢∕ysql錛?IMG height=19 src="http://m.tkk7.com/Emoticons/teeth_smile.gif" width=19 border=0><BR><BR>浣嗘槸榪欒偗瀹氫笉鏄渶緇堢殑瑙e喅鍔炴硶銆?BR></P><img src ="http://m.tkk7.com/mstar/aggbug/3849.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/mstar/" target="_blank">榛戠伒</a> 2005-04-27 15:48 <a href="http://m.tkk7.com/mstar/archive/2005/04/27/3849.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>caveatemptor涓殑HibernateUtilhttp://m.tkk7.com/mstar/archive/2005/04/26/3804.html榛戠伒榛戠伒Tue, 26 Apr 2005 00:26:00 GMThttp://m.tkk7.com/mstar/archive/2005/04/26/3804.htmlhttp://m.tkk7.com/mstar/comments/3804.htmlhttp://m.tkk7.com/mstar/archive/2005/04/26/3804.html#Feedback0http://m.tkk7.com/mstar/comments/commentRss/3804.htmlhttp://m.tkk7.com/mstar/services/trackbacks/3804.html闃呰鍏ㄦ枃

榛戠伒 2005-04-26 08:26 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 亚洲精品偷拍视频免费观看| 一级毛片免费观看不收费| 永久免费观看黄网站| 在线观看视频免费完整版| 亚洲国产精品人久久| 精品国产呦系列在线观看免费| 国产成人免费ā片在线观看| 亚洲国产中文在线二区三区免| 91麻豆国产免费观看| 在线精品亚洲一区二区小说| 一级毛片视频免费| 亚洲AV中文无码乱人伦| 国产大陆亚洲精品国产| 亚洲中文字幕无码专区| 成全视频免费观看在线看| 亚洲AV本道一区二区三区四区| 特级无码毛片免费视频尤物 | 亚洲AV无码一区二区乱子仑| 午夜神器成在线人成在线人免费| 亚洲乱码无人区卡1卡2卡3| 免费一级毛片在线观看| 青青操在线免费观看| 亚洲精品中文字幕无乱码| 成人毛片18女人毛片免费96 | 亚洲av丰满熟妇在线播放| 最近中文字幕高清免费中文字幕mv | 久久精品成人免费观看| 亚洲国产日产无码精品| 国产一区二区免费在线| 国产在线观看免费av站| 亚洲国产精品白丝在线观看| 日韩免费一区二区三区| 国产在线精品观看免费观看| 亚洲国产精品张柏芝在线观看 | 精品免费视在线观看| 亚洲男人天堂2018av| 在线观看午夜亚洲一区| 在线观看特色大片免费视频| aa午夜免费剧场| 亚洲影视自拍揄拍愉拍| av在线亚洲欧洲日产一区二区|