1.從網(wǎng)站下載到hibernate包,解壓到eclipse文件夾;重啟eclipse;
2.建立初級(jí)別 hibernate(從數(shù)據(jù)庫(kù)到hibernate)
建立工程“hibernate”;在src文件夾中新建配置文件hibernate.cfg.xml(hibernate型,名稱固定);
在工程中新建文件夾lib,引入所有的包,共3個(gè)部分:D:\Program Files\hibernate-annotations-3.3.0.GA\lib 和 D:\Program Files\hibernate-annotations-3.3.0.GA 、D:\Program Files\hibernate-3.2 和 D:\Program Files\hibernate-3.2\lib 下的所有jar文件,及D:\oracle\product\11.1.0\db_1\jdbc\lib下的ojdbc6.jar文件;選中所有的jar文件,加入到path中(選中,右鍵,“build path”)
進(jìn)入hibernate狀態(tài),新建文件"hibernate"(填選"project"和"configuration file",分別是對(duì)應(yīng)的工程和配置文件);
點(diǎn)hibernate運(yùn)行鍵(open hibernate code...),在對(duì)話框中,新建文件“test”,在“Main”選擇區(qū),填選“console configuration”(“hibernate”工程)、“Output directory”(選擇一個(gè)文件夾)、“Package”(文件夾中的包);在“exporters”選擇區(qū),選中 java 5 和 EJB 3 ,在“Exporters”中選“.java”;Run
在配置文件中加入“<mapping class = "com.yiqi.Test"/>”
測(cè)試
posted on 2007-11-29 10:40
BlueSunshine 閱讀(215)
評(píng)論(0) 編輯 收藏 所屬分類:
學(xué)習(xí)心得