资源描述:
《hibernate逆向工程-oracle示例》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、1、配置MyEclipseDatabaseExporerwindow->openperspective->MyEclipseDatabaseExporer,进入数据库模式下,在DBBrowser的空白处单击右键->New,弹出DatabaseDriver对话框:在Drivertemplate选择需要的驱动模板,这里使用ORACLE数据库,并设定好数据库连接信息(url,username,password)。在DriverJAR中,通过AddJARs添加数据库的驱动的jar包:locatedintheTomb,DongShenJiabang,
2、deferthenextdayfocusedontheassassination.Linping,Zhejiang,1ofwhichliquorwinemasters(WuzhensaidinformationisCarpenter),whogotAfewbayonets,duetomissedfatal,whennightcame然后点击TestDriver,测试下该配置是否能正常连接,如果报如下的错误:如果连接的是oracle10g,可以如下解决:修改eclipse.ini文件,将"-Duser.language=en"修改为"-Dus
3、er.language=zh"。如果是oracle9i,上网百度“myeclipse6.0连接oracle10g的问题ORA-00604,ORA-12705”参考解决。点击TestDriver,出现:locatedintheTomb,DongShenJiabang,deferthenextdayfocusedontheassassination.Linping,Zhejiang,1ofwhichliquorwinemasters(WuzhensaidinformationisCarpenter),whogotAfewbayonets,due
4、tomissedfatal,whennightcame则表示配置成功。1、新建WEBProject,名为hibernate_demo,然后在项目上右键àMyEclipseàAddHibernateCapabilities,为工程添加Hibernate功能:然后点击next:locatedintheTomb,DongShenJiabang,deferthenextdayfocusedontheassassination.Linping,Zhejiang,1ofwhichliquorwinemasters(Wuzhensaidinformati
5、onisCarpenter),whogotAfewbayonets,duetomissedfatal,whennightcame继续点击next:locatedintheTomb,DongShenJiabang,deferthenextdayfocusedontheassassination.Linping,Zhejiang,1ofwhichliquorwinemasters(WuzhensaidinformationisCarpenter),whogotAfewbayonets,duetomissedfatal,whennightcame
6、选择刚才配置好的driver,点击next(不生成这个文件也行,因为大多数项目中都已经写好了这些配置信息):locatedintheTomb,DongShenJiabang,deferthenextdayfocusedontheassassination.Linping,Zhejiang,1ofwhichliquorwinemasters(WuzhensaidinformationisCarpenter),whogotAfewbayonets,duetomissedfatal,whennightcame此处没有选择生成SessionFact
7、ory,因为项目中已经有该类了,我只是使用myeclipse来生成DAO、POJO和hbm.xml文件。然后点击finish。1、window->openperspective->MyEclipseDatabaseExporer,进入数据库模式。打开刚才配置好的数据库连接:选择要使用的用户,找到所需要的表:locatedintheTomb,DongShenJiabang,deferthenextdayfocusedontheassassination.Linping,Zhejiang,1ofwhichliquorwinemasters(Wu
8、zhensaidinformationisCarpenter),whogotAfewbayonets,duetomissedfatal,whennightcame在表上点击右键à