锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲色大成网站www永久,亚洲av日韩专区在线观看,亚洲制服中文字幕第一区http://www.tkk7.com/waterjava/category/16551.html闂婚亾鏈夊厛鍚? 鏈笟鏈変笓鏀?/description>zh-cnThu, 01 Mar 2007 15:35:41 GMTThu, 01 Mar 2007 15:35:41 GMT60Hibernate閰嶇疆鎵嬪唽http://www.tkk7.com/waterjava/archive/2006/11/06/79301.html鐙肩埍涓婄嫺鐙肩埍涓婄嫺Sun, 05 Nov 2006 22:30:00 GMThttp://www.tkk7.com/waterjava/archive/2006/11/06/79301.htmlhttp://www.tkk7.com/waterjava/comments/79301.htmlhttp://www.tkk7.com/waterjava/archive/2006/11/06/79301.html#Feedback0http://www.tkk7.com/waterjava/comments/commentRss/79301.htmlhttp://www.tkk7.com/waterjava/services/trackbacks/79301.html鍑哄:http://www.chinabs.net/webj2ee/default.asp?infoid=424

Hibernate.cfg.xml閰嶇疆鏂囦歡錛?br /><?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN" "hibernate-configuration-2.0.dtd">
<hibernate-configuration>
聽聽聽 <session-factory>
聽聽聽聽聽聽聽 <!-- properties -->
聽聽聽聽聽聽聽 <!-- jndi -->
聽聽聽聽聽聽聽 <property name="connection.datasource">java:comp/env/jdbc/quickstart</property>
聽聽聽聽聽聽聽 <property name="connection.provider_class">net.sf.hibernate.connection.DatasourceConnectionProvider</property>
聽聽聽聽聽聽聽 <property name="dialect">net.sf.hibernate.dialect.SQLServerDialect</property>
聽聽聽聽聽聽聽 <!-- jdbc
聽聽聽聽聽聽聽 <property name="connection.url">jdbc:microsoft:sqlserver://localhost:1433;SelectMethod=cursor;DatabaseName=pubs</property>
聽聽聽聽聽聽聽 <property name="connection.driver_class">com.microsoft.jdbc.sqlserver.SQLServerDriver</property>
聽聽聽聽聽聽聽 <property name="connection.username">sa</property>
聽聽聽聽聽聽聽 <property name="connection.password"></property>
聽聽聽聽聽聽聽聽 -->
聽聽聽聽聽聽聽 <property name="jdbc.fetch_size">50</property><!-- 涓嬈¤鐨勬暟鎹簱璁板綍鏁?-->
聽聽聽聽聽聽聽 <property name="jdbc.batch_size">30</property><!-- 璁懼畾瀵規暟鎹簱榪涜鎵歸噺鍒犻櫎 -->
聽聽聽聽聽聽聽 <property name="show_sql">true</property><!-- 灝咹ibernate鍙戦佺粰鏁版嵁搴撶殑sql鏄劇ず鍑烘潵 -->
聽聽聽聽聽聽聽 <!-- Mapping files -->
聽聽聽聽聽聽聽 <mapping resource="cat.hbm.xml"/>
聽聽聽 </session-factory>
</hibernate-configuration>


鏁版嵁搴撹〃涓婚敭鐨勭煡璇嗙偣錛?br />Generator 涓烘瘡涓?POJO 鐨勫疄渚嬫彁渚涘敮涓鏍囪瘑銆備竴鑸儏鍐碉紝鎴戜滑浣跨敤鈥渘ative鈥濄俢lass 琛ㄧず閲囩敤鐢辯敓鎴愬櫒鎺ュ彛net.sf.hibernate.id.IdentifierGenerator 瀹炵幇鐨勬煇涓疄渚嬶紝鍏朵腑鍖呮嫭錛?/p>

鈥渁ssigned鈥?br />涓婚敭鐢卞閮ㄧ▼搴忚礋璐g敓鎴愶紝鍦?save() 涔嬪墠鎸囧畾涓涓?/p>

鈥渉ilo鈥?br />閫氳繃hi/lo 綆楁硶瀹炵幇鐨勪富閿敓鎴愭満鍒訛紝闇瑕侀澶栫殑鏁版嵁搴撹〃鎴栧瓧孌墊彁渚涢珮浣嶅兼潵婧愩?/p>

鈥渟eqhilo鈥?br />涓巋ilo 綾諱技錛岄氳繃hi/lo 綆楁硶瀹炵幇鐨勪富閿敓鎴愭満鍒訛紝闇瑕佹暟鎹簱涓殑 Sequence錛岄傜敤浜庢敮鎸?Sequence 鐨勬暟鎹簱錛屽Oracle銆?/p>

鈥渋ncrement鈥?br />涓婚敭鎸夋暟鍊奸『搴忛掑銆傛鏂瑰紡鐨勫疄鐜版満鍒朵負鍦ㄥ綋鍓嶅簲鐢ㄥ疄渚嬩腑緇存寔涓涓彉閲忥紝浠ヤ繚瀛樼潃褰撳墠鐨勬渶澶у鹼紝涔嬪悗姣忔闇瑕佺敓鎴愪富閿殑鏃跺欏皢姝ゅ煎姞1浣滀負涓婚敭銆傝繖縐嶆柟寮忓彲鑳戒駭鐢熺殑闂鏄細涓嶈兘鍦ㄩ泦緹や笅浣跨敤銆?/p>

鈥渋dentity鈥?br />閲囩敤鏁版嵁搴撴彁渚涚殑涓婚敭鐢熸垚鏈哄埗銆傚DB2銆丼QL Server銆丮ySQL 涓殑涓婚敭鐢熸垚鏈哄埗銆?/p>

鈥渟equence鈥?br />閲囩敤鏁版嵁搴撴彁渚涚殑 sequence 鏈哄埗鐢熸垚涓婚敭銆傚 Oralce 涓殑Sequence銆?/p>

鈥渘ative鈥?br />鐢?Hibernate 鏍規嵁浣跨敤鐨勬暟鎹簱鑷鍒ゆ柇閲囩敤 identity銆乭ilo銆乻equence 鍏朵腑涓縐嶄綔涓轟富閿敓鎴愭柟寮忋?


鈥渦uid.hex鈥?br />鐢?Hibernate 鍩轟簬128 浣?UUID 綆楁硶 鐢熸垚16 榪涘埗鏁板鹼紙緙栫爜鍚庝互闀垮害32 鐨勫瓧絎︿覆琛ㄧず錛変綔涓轟富閿?/p>

鈥渦uid.string鈥?br />涓巙uid.hex 綾諱技錛屽彧鏄敓鎴愮殑涓婚敭鏈繘琛岀紪鐮侊紙闀垮害16錛夛紝涓嶈兘搴旂敤鍦?PostgreSQL 鏁版嵁搴撲腑銆?/p>

鈥渇oreign鈥?br />浣跨敤鍙﹀涓涓浉鍏寵仈鐨勫璞$殑鏍囪瘑絎︿綔涓轟富閿?/p>

浠ヤ笅涓句緥錛?br />1銆佹寚瀹氬弬鏁扮殑鎯呭喌錛?br />聽聽聽 <id name="id" unsaved-value="0">
聽聽聽聽聽 <generator class="sequence">
聽聽聽聽聽聽聽 <param name="sequence">SEQ_CHILD</param>
聽聽聽聽聽 </generator>
</id>
浣跨敤鐨勬槸sequence錛岄傚悎oracle鏁版嵁搴擄紱


2銆佸浜巗ql server2000涓殑鏁版嵁搴撳瓙澧炲瓧孌?鍦ㄩ厤緗枃浠朵嬌鐢ㄤ笅鍒楁柟娉曞疄鐜幫細
<id name="id" type="long" unsaved-value="0">
聽聽聽聽 <column name="id" sql-type="numeric" not-null="true" />
聽聽聽聽 <generator class="identity" />
</id>
榪欓噷涓昏鏄?identity:浠h〃鐢眘ql server2000鏁版嵁搴撹嚜宸辨彁渚涘瓙澧炲瓧孌?濡傛灉瑕乭ibernate鑷繁鎻愪緵,鍒欑敤increment鍏抽敭瀛楁潵瀹炵幇


3銆佸鏋滆〃涓殑涓婚敭鐢ㄥ瓧絎︿覆綾誨瀷:鍙互鐢╤ibernate鑷繁鎻愪緵鐨勬柟娉曞疄鐜頒富閿敮涓:
聽 <id name="id" type="string" unsaved-value="null">
聽聽聽聽聽 <column name="cid" sql-type="char(32)" not-null="true" />
聽聽聽聽聽 <generator class="uuid.hex" />
聽 </id>
浣跨敤鐨勬槸uuid.hex: 閲囩敤128浣嶇殑綆楁硶鏉ョ敓鎴愪竴涓?2浣嶅瓧絎︿覆銆傛渶閫氱敤鐨勪竴縐嶆柟寮忋傞傜敤浜庢墍鏈夋暟鎹簱銆?/p>

閲嶈鐨勭煡璇嗙偣:
1. 濡傛灉鏈夐儴闂ㄨ〃,鏈夊憳宸ヨ〃,鍛樺伐琛ㄤ腑鏈塪ep_id,鍒欒〃閮ㄩ棬綾誨拰鍛樺伐綾繪槸one-to-many鐨勫叧緋?
聽聽 鍙互浣跨敤:聽 ( 鍦ㄩ儴闂ㄧ被department涓嬌鐢ㄤ笅鍒?
聽聽 Department綾?聽
聽聽聽聽 /**聽 閮ㄩ棬鐨勬墍鏈夊憳宸ヂ犅?*/
聽聽聽 private Set staffs = new TreeSet();
聽聽聽
聽聽聽 xml鐨勬枃浠?
聽聽聽聽聽 <set name="staffs" >
聽聽聽聽聽聽聽聽聽 <key column="dep_id"/>
聽聽聽聽聽聽聽聽聽 <one-to-many class="hbp.sys.data.Staff"/>
聽聽聽聽聽 </set>
聽聽聽聽聽 濡傛灉鏄痩ist,闇瑕佺敤绱㈠紩<index> </index>,鍏蜂綋鍏朵腑鐨勫惈涔?涓嶆槸寰堟槑鐧?寰呬互鍚庣爺絀?br />聽聽聽聽聽
聽2. 濡傛灉閮ㄩ棬瑕佹湁涓涓礋璐d漢,鍗抽儴闂ㄨ〃(tb_department)涓湁涓涓瓧孌?staff_id.
聽聽聽聽 閭d箞琛ㄧず閮ㄩ棬鍜岃礋璐d漢涔嬮棿鐨勫叧緋繪槸many-to-one鐨勫叧緋?br />聽聽聽聽 Department綾?
聽聽聽聽聽 /** 閮ㄩ棬璐熻矗浜篿d */
聽聽聽 private Staff staff;
聽聽聽
聽聽聽 xml 鏂囦歡
聽聽聽聽 <many-to-one name="staff" class="hbp.sys.data.Staff"聽 column="staff_id"/>聽

聽3. 澶氬澶氬叧緋?涓鑸垜浠槸鍋氫竴涓腑闂村叧鑱旇〃.鎴戠敤瑙掕壊鍜屾潈闄愬仛浜嗕釜渚嬪瓙,
聽聽聽聽聽 Right(id,name)聽聽聽聽 Role(id,name)聽聽 涓棿琛?tb_role_right(role_id,right_id)
聽聽聽聽聽 Right綾諱腑鏈変竴涓猂ole鐨勯泦鍚?private Set roles=new TreeSet();
聽聽聽聽聽 Role綾諱腑涔熸湁涓涓猂ight鐨勯泦鍚?private Set rights=new TreeSet();
聽聽聽聽聽 鍒欎袱鑰呮槸鏄庢樉鐨勫瀵瑰鍏崇郴.浣跨敤many-to-many鏉ュ疄鐜?
聽聽聽聽聽 xml鏂囦歡涓?br />聽聽聽聽聽 right.hbm.xml:濡備笅:
聽聽聽聽聽聽聽 <set name="roles" table="tb_role_right" cascade="all">
聽聽聽聽聽聽聽聽聽聽 <key column="right_id"/>
聽聽聽聽聽聽聽聽聽聽 <many-to-many column="role_id" class="hbp.sys.data.Role"/>
聽聽聽聽聽聽聽 </set>
聽聽聽聽聽 role.hbm.xml鏂囦歡涓被浼?
聽聽聽聽聽聽聽 <set name="rights" table="tb_role_right" cascade="all">
聽聽聽聽聽聽聽聽聽 <key column="role_id"/>
聽聽聽聽聽聽聽聽聽 <many-to-many column="right_id" class="hbp.sys.data.Right"/>
聽聽聽聽聽聽聽 </set>


4. 鍑犱釜鍊煎緱娉ㄦ剰鐨勯棶棰?
聽聽聽聽聽聽聽 a)鍦▁ml?鏄犲皠鏂囦歡涓?鍐欑被鐨勫悕瀛楁椂涓瀹氱敤綾葷殑鍏ㄥ悕:鍗?鍖?綾誨悕濡?(hbp.sys.data.Staff),榪欎釜閿欒浣挎垜璐逛簡鍗婂ぉ鍔?:(
聽聽聽聽聽聽聽 b)鎴戝湪鍐欏疄鐜板熀鏈珼AO鎿嶄綔鏃?鍐欎簡
聽聽聽聽聽聽聽聽聽聽聽聽 session.delete("from Right as right where right.id="+id);聽
聽聽聽聽聽聽聽聽聽聽聽聽 紼嬪簭姝繪椿鎶ラ敊,鎴戞姌鑵句簡鍗婂ぉ,璺熻釜鍒板簳,鎵嶆亶鐒跺ぇ鎮?hibernate鍦ㄨВ鏋恠ql璇彞鐨勬椂鍊欐妸
聽聽聽聽聽聽聽聽聽聽聽聽 鍏朵腑鐨剅ight,褰撴垚浜嗘暟鎹簱涓殑鍙寵繛鎺?"淇濈暀瀛?),鍞?榪欑鍏抽敭瀛?涓嶈兘闅忎究鐢ㄥ晩,:)


5. hibernate涓璈QL璇█鐨勬煡璇㈡牴鎹綘鐨剆ql鐨勪笉鍚岃岃繑鍥炰笉鍚岀殑瀵硅薄綾誨瀷.
聽聽聽聽聽聽聽聽 濡傛灉浣犱嬌鐢╯ession.find(String hql)
聽聽聽聽聽聽聽聽 涓鑸細榪斿洖涓涓狶ist,濡?from Staff staff;榪斿洖鐨勬槸鍖呭惈鎵鏈夌殑鍛樺伐瀵硅薄鐨勯泦鍚?br />聽聽聽聽聽聽聽聽 濡備綘鐨刪ql涓?select count(*) from Staff staff;鍒欒繑鍥炵殑鏄竴涓狪nteger瀵硅薄
聽聽聽聽聽聽聽聽 濡傛灉浣犱嬌鐢ㄧ殑hql涓?select count(distinct staff.name),count(*) from Staff staff;鍒欒繑鍥炵殑鏄竴涓狾bject
聽聽聽聽聽聽聽聽 鍗砄bject[],闇瑕佸厛鎶婁粬杞崲鎴怬bject[],鐒跺悗鍦ㄥ彇[0],[1].
聽聽聽聽聽聽聽聽 榪欑璁捐鎴戜笉鐭ラ亾hibernate鏄浣曞鐞嗙殑,鎰熻鏃㈠ソ涔熶笉濂?濂界殑鏄彲浠ヤ嬌鐢ㄤ竴涓猣ind鑾峰緱浠繪剰鏌ヨ
聽聽聽聽聽聽聽聽 涓嶅ソ鍦ㄤ簬鏍規嵁hql鏉ュ鐞嗚繑鍥炵粨鏋?瀹規槗鍑洪敊.



]]>
hibernate3+mysql5.0+tomcat5.5.20鐨刪ibernate.cfg.xml鏂囦歡http://www.tkk7.com/waterjava/archive/2006/10/24/76987.html鐙肩埍涓婄嫺鐙肩埍涓婄嫺Tue, 24 Oct 2006 07:25:00 GMThttp://www.tkk7.com/waterjava/archive/2006/10/24/76987.htmlhttp://www.tkk7.com/waterjava/comments/76987.htmlhttp://www.tkk7.com/waterjava/archive/2006/10/24/76987.html#Feedback0http://www.tkk7.com/waterjava/comments/commentRss/76987.htmlhttp://www.tkk7.com/waterjava/services/trackbacks/76987.html<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration
聽聽聽 PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
聽聽聽 "

<hibernate-configuration>

聽聽聽 <session-factory>


聽聽聽聽聽聽聽 <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>

聽聽聽聽聽聽聽 <property name="hibernate.connection.url">jdbc:mysql:///test</property>

聽聽聽聽聽聽聽 <property name="hibernate.connection.username">username</property>

聽聽聽聽聽聽聽 <property name="hibernate.connection.password">password</property>

聽聽聽聽聽聽聽 <property name="hibernate.connection.pool_size">100</property>

聽聽聽聽聽聽 聽<property name="show_sql">false</property>

聽聽聽聽聽聽聽 <property name="dialect"> org.hibernate.dialect.MySQLDialect</property>

聽聽聽聽聽聽聽 <!-- Mapping files -->
聽聽聽聽聽聽聽 <mapping resource="Train.hbm.xml"/>

聽聽聽 </session-factory>

</hibernate-configuration>



]]>
hibernate3+mssql2000+tomcat5.5.20鐨刪ibernate.cfg.xmlhttp://www.tkk7.com/waterjava/archive/2006/10/24/76986.html鐙肩埍涓婄嫺鐙肩埍涓婄嫺Tue, 24 Oct 2006 07:22:00 GMThttp://www.tkk7.com/waterjava/archive/2006/10/24/76986.htmlhttp://www.tkk7.com/waterjava/comments/76986.htmlhttp://www.tkk7.com/waterjava/archive/2006/10/24/76986.html#Feedback0http://www.tkk7.com/waterjava/comments/commentRss/76986.htmlhttp://www.tkk7.com/waterjava/services/trackbacks/76986.html<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
聽聽聽聽聽聽聽聽聽 "-//Hibernate/Hibernate Configuration DTD 2.0//EN"
聽聽聽聽聽聽聽聽聽 "

<!-- DO NOT EDIT: This is a generated file that is synchronized -->
<!-- by MyEclipse Hibernate tool integration.聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 -->
<hibernate-configuration>

聽聽聽 <session-factory>
聽聽聽聽聽聽聽 <!-- properties -->
聽聽聽聽聽聽聽 <property name="connection.username">username</property>
聽聽聽聽聽聽聽 <property name="connection.url">jdbc:microsoft:sqlserver://localhost:1433;databaseName=test</property>
聽聽聽聽聽聽聽 <property name="dialect">org.hibernate.dialect.SQLServerDialect</property>
聽聽聽聽聽聽聽 <property name="connection.password">password</property>
聽聽聽聽聽聽聽 <property name="connection.driver_class">com.microsoft.jdbc.sqlserver.SQLServerDriver</property>

聽聽聽聽聽聽聽 <!-- mapping files -->
聽聽聽聽聽聽聽 <mapping resource="Train.hbm.xml"/>

聽聽聽 </session-factory>

</hibernate-configuration>



]]>
主站蜘蛛池模板: 亚洲依依成人精品| 亚洲一级毛片免费观看| 日韩大片在线永久免费观看网站| 精品久久久久久久免费加勒比| 色噜噜亚洲男人的天堂| 在线免费一区二区| 亚洲日本一线产区和二线 | 亚洲人成网站观看在线播放| 国产精品亚洲а∨无码播放麻豆| 国产精品免费小视频| 男男gay做爽爽免费视频| 亚洲A丁香五香天堂网| 青青操免费在线视频| 亚洲天堂视频在线观看| 又大又硬又爽又粗又快的视频免费| 亚洲第一精品电影网| 99视频在线精品免费观看6| 亚洲aⅴ天堂av天堂无码麻豆| 国产成人无码区免费A∨视频网站 国产成人涩涩涩视频在线观看免费 | 亚洲一本之道高清乱码| 最近中文字幕无免费视频| 老子影院午夜伦不卡亚洲| 亚洲精品国产精品乱码不卡| 中国国产高清免费av片| 97亚洲熟妇自偷自拍另类图片 | 未满十八私人高清免费影院| 国产成人A亚洲精V品无码 | 亚洲av最新在线观看网址| 亚洲AV无码乱码在线观看| 中文成人久久久久影院免费观看| 一区二区三区亚洲| 国产免费资源高清小视频在线观看| 人妻免费久久久久久久了| 久久亚洲精品成人av无码网站| 青青青免费国产在线视频小草| 久久久久亚洲精品无码网址色欲 | 亚洲精品成a人在线观看| 久久久久免费看成人影片| 亚洲国产精品美女久久久久| 精品亚洲综合在线第一区| 成年人免费视频观看|