我使用的是oracle数据库
参考文章:
http://wanzhi002.blog.sohu.com/68115976.html
http://blog.csdn.net/sukyle/article/details/3778102
http://blog.csdn.net/sukyle/article/details/3778102
http://blog.csdn.net/asepigfighting/article/details/6488411
一.参照 http://wanzhi002.blog.sohu.com/68115976.html 进行 Middlegen-Hibernate 配置
1.修改oracle.xml
<property environment="env"/>
<property name="database.script.file" value="${src.dir}/sql/users-oracle.sql"/>
<property name="database.driver.file" value="${lib.dir}/ojdbc14.jar"/>
<property name="database.driver.classpath" value="${database.driver.file}"/>
<property name="database.driver" value="oracle.jdbc.driver.OracleDriver"/>
<property name="database.url" value="jdbc:oracle:thin:@localhost:1521:ORCL"/>
<property name="database.userid" value="yu"/>
<property name="database.password" value="yu"/>
<property name="database.schema" value="yu"/>
<property name="database.catalog" value=""/>
<!--property name="jboss.datasource.mapping" value="Oracle7"/-->
<property name="jboss.datasource.mapping" value="Oracle8"/>
<!--property name="jboss.datasource.mapping" value="Oracle9i"/-->
2.修改build.xml
二.启动ant 前,jdk的环境变量要配置好的
判断标准,在dos命令窗口中 运行 javac 能显示操作提示
三.配置hibernate-extensions 参考http://blog.csdn.net/sukyle/article/details/3778102
注意:http://blog.csdn.net/asepigfighting/article/details/6488411
我在运行 F:\hibernate\hibernate-extensions-2.1.3\tools\bin>hbm2java C:\hbm\org\hibernate\model\*.xml -- output:C:\src
报错:HIBERNATETOOLS_HOME set to F:\hibernate\hibernate-extensions-2.1.3\tools
Exception in thread "main" java.lang.NoClassDefFoundError: Files\Java\jdk1/7/0_01\lib;C:\Program
解决方法,参考http://blog.csdn.net/asepigfighting/article/details/6488411 去掉%CLASSPATH%;%
就可以运行正常了
但是有一点不完美:输出的java文件是在hibernate-extensions bin文件夹下