Hibernate Reverse Engineering生成ORM持久化类的问题

本文解决Hibernate逆向工程中遇到的版本不匹配、路径配置错误及Java源文件夹不可选等问题,通过修改.myhibernatedata和.project文件来确保生成正确的ORM映射。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Hibernate Reverse Engineering 生成ORM持久化类的问题

报错1:
点击"Hibernate Reverse Engineering"出现如下错误:
"This wizard generates Hibernate3.0 OR mappings(*.hbm.xml).The project your select is a Hibernate 2 project.
Execution of this wizard may produce incompatible mapping files".

解决办法:到工程根目录下,用文本编辑器打开.myhibernatedata文件,内容如下:
修改文件中的"version"的值,修改为3.1。

报错2:
出现了错误:"Path must include project and resource name:/"
解决办法:到工程根目录下,用文本编辑器打开.myhibernatedata文件,进行如下修改
libInstallFolder=/WebRoot/WEB-INF/lib 
configFile=/test/src/hibernate.cfg.xml

将"libInstallFolder"和"configFile"的内容补充完整,如果是空的,或者不存在会报以上的错误。

无法选择Java src folder
到工程根目录下找到.project这个文件。
在最后的natures中加入<nature>com.genuitec.eclipse.hibernate.hibernatenature</nature>
<natures>
  <nature>com.genuitec.eclipse.hibernate.hibernatenature</nature>
  <nature>com.genuitec.eclipse.ast.deploy.core.deploymentnature</nature>
  <nature>com.genuitec.eclipse.j2eedt.core.webnature</nature>
  <nature>org.eclipse.jdt.core.javanature</nature>
</natures>

 

转载来源:http://blog.youkuaiyun.com/ljhabc1982/article/details/7802822

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值