[Hibernate3] eclipse 3.3 自動產生table 對應xml目前使用sql server 2005, 產生table的xxx.hbm.xml使用流程1. 下載hibernate plugin for eclipse, 目前為3.2beta10, 連結為:按我2. 解壓縮放入eclipse plugins 和 features 資料夾3. 開啟eclipse3.34. 先產生hibernate.cfg.xml, new--> other --> hibernate --> hibernate configuration file5. 相關設定填入, 便產生了hibernate.cfg.xml, 請確認內容! 產生driver class時, microsoft的jdbc好像有錯, 手動改成: com.microsoft.sqlserver.jdbc.SQLServerDriver connection.url改成 jdbc:sqlserver://hostname:1433;DatabaseName=nalicprotal;SelectMethod=cursor6. 開啟hibernate console 頁籤, 點database 看是否有成功連結資料庫7. 點選"run" 下拉圖鈕, 選擇"Open Hibernate code Generation dialog...", 開啟視窗後, hibernate Code tree按右鍵, new 新的 configuration, 好給個頁籤8. main 頁籤, 填入console configuration, 選擇output directory, 勾選Reverse engineer from JDBC Connection 9. 填入欲輸出的package , 選擇 reveng.xml 右邊 "Setup..."10. 開啟對話框, 按"Create new...", 將hibernate.reveng.xml 選擇存放位置後, --> Next databse 視窗, 按"refresh" 將table列出後, 選擇欲轉出的table, 按"Finish"11. 關閉對話框回到configuration, 到"Export" 頁籤, 選擇要輸出的格式 按"Apply" 按"Run"此時就可以順利轉出xxx.hbm.xml了, 若有句選vo也會轉出vo! .msgcontent .wsharing ul li { text-indent: 0; } 分享 Facebook Plurk YAHOO! .
- Jan 08 Sun 2012 08:52
[Hibernate3] eclipse 3.3 自動產生table 對應xml
全站熱搜
留言列表
禁止留言