課程
/后端開發
/Java
/Hibernate初探之單表映射
myeclipse10沒法安裝hibernate tool也沒法自動生成hbm.xml
2016-10-25
源自:Hibernate初探之單表映射 1-10
正在回答
我的myeclipse運行成功了,
1.首先連接數據庫,在myeclipse的右上角沒有模糊的按鈕
2.選擇myeclipse DataBase Explorer
3.在空白處點擊右鍵點擊new按鈕
4.如下圖,自己配置好。
5.按下圖,直接點擊next。
6.按下圖,再次點擊next。
7.點擊finish。
然后生成了Students.hbm.xml文件。
最后按下面修改一下自動生成的Students.hbm.xml,修改成如下的代碼:
<hibernate-mapping>
? ? <class name="Students" table="students" catalog="hibernate">
? ? ? ? <composite-id>
? ? ? ? ? ? <key-property name="sid" type="java.lang.Integer">
? ? ? ? ? ? ? ? <column name="sid" />
? ? ? ? ? ? </key-property>
? ? ? ? ? ? <key-property name="sname" type="java.lang.String">
? ? ? ? ? ? ? ? <column name="sname" length="20" />
? ? ? ? ? ? <key-property name="gender" type="java.lang.String">
? ? ? ? ? ? ? ? <column name="gender" length="2" />
? ? ? ? ? ? <key-property name="birthday" type="java.sql.Timestamp">
? ? ? ? ? ? ? ? <column name="birthday" length="19" />
? ? ? ? ? ? <key-property name="address" type="java.lang.String">
? ? ? ? ? ? ? ? <column name="address" length="100" />
? ? ? ? </composite-id>
? ? </class>
</hibernate-mapping>
最后,一旦 自動生成了Students.hbm.xml,,,hibernate.cfg.xml會自動添加這行代碼
<mapping resource="./Students.hbm.xml" />
WOshows 提問者
下載tool沒成功
下載好hibernate組件,然后點eclipse 里的help,----install newsoftware,---add ? 然后選擇location 和name,next ,next , finish.就完成了
舉報
Java持久化框架Hibernate入門教程,掌握Hibernate基本概念
3 回答請問myeclipse 怎么生成 hbm 文件
1 回答怎么自動生成映射文件???
4 回答Myeclipse怎么生成這個對象關系映射文件?
2 回答MyEclipse如何自動創建表
3 回答主鍵自動生成問題
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2017-08-28
我的myeclipse運行成功了,
1.首先連接數據庫,在myeclipse的右上角沒有模糊的按鈕
2.選擇myeclipse DataBase Explorer
3.在空白處點擊右鍵點擊new按鈕
4.如下圖,自己配置好。
5.按下圖,直接點擊next。
6.按下圖,再次點擊next。
7.點擊finish。
然后生成了Students.hbm.xml文件。
最后按下面修改一下自動生成的Students.hbm.xml,修改成如下的代碼:
<hibernate-mapping>
? ? <class name="Students" table="students" catalog="hibernate">
? ? ? ? <composite-id>
? ? ? ? ? ? <key-property name="sid" type="java.lang.Integer">
? ? ? ? ? ? ? ? <column name="sid" />
? ? ? ? ? ? </key-property>
? ? ? ? ? ? <key-property name="sname" type="java.lang.String">
? ? ? ? ? ? ? ? <column name="sname" length="20" />
? ? ? ? ? ? </key-property>
? ? ? ? ? ? <key-property name="gender" type="java.lang.String">
? ? ? ? ? ? ? ? <column name="gender" length="2" />
? ? ? ? ? ? </key-property>
? ? ? ? ? ? <key-property name="birthday" type="java.sql.Timestamp">
? ? ? ? ? ? ? ? <column name="birthday" length="19" />
? ? ? ? ? ? </key-property>
? ? ? ? ? ? <key-property name="address" type="java.lang.String">
? ? ? ? ? ? ? ? <column name="address" length="100" />
? ? ? ? ? ? </key-property>
? ? ? ? </composite-id>
? ? </class>
</hibernate-mapping>
最后,一旦 自動生成了Students.hbm.xml,,,hibernate.cfg.xml會自動添加這行代碼
<mapping resource="./Students.hbm.xml" />
2016-10-25
下載tool沒成功
2016-10-25
下載好hibernate組件,然后點eclipse 里的help,----install newsoftware,---add ? 然后選擇location 和name,next ,next , finish.就完成了