1:download Middlegen-Hibernate-r5
地址:URL http://voxel.dl.sourceforge.net/sourceforge/hibernate/Middlegen-Hibernate-r5.zip
2:解压缩
将下载的解压缩,如 c:/Middlegen-Hibernate-r5
3:配置数据库文件
../config/database 子目录,选择你要得数据库文件,比如oracle,编辑修改如下
. <!-- =================================================================== -->
<!-- ant properties/targets for oracle 8/9 -->
<!-- note: this is not a proper xml file (there is no root element) -->
<!-- it is intended to be imported from a *real* xml file -->
<!-- =================================================================== -->
<!-- please set your Oracle-SID according to your needs -->
<property environment="env"/>
<property name="database.script.file" value="${src.dir}/sql/${name}-oracle.sql"/>
<property name="database.driver.file" value="D:/ForDeploy/classes12.zip"/>
<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:@bjtest1:1521:bjtest"/>
<property name="database.userid" value="rw"/>
<property name="database.password" value="rw"/>
<property name="database.schema" value="rw"/>
<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"/>
将oracle的驱动程序class12.zip copy 到c:/Middlegen-Hibernate-r5/lib下
4:修改Build.xml, 以下步骤如 (注意数据的不同):文章:
使用MiddleGen 产生hibernate的数据库表映射文件 选择自 kasam 的 Blog ,中描述
5:切换到D:/Middlegen-Hibernate-r5目录,运行ant, ant下载地址:http://jakarta.apache.org/builds/jakarta-ant/release/
如ant安装目录为c:/ant,按下面方法设置
set ANT_HOME=c:/ant
set JAVA_HOME=c:/jdk1.3
set PATH=%PATH%;%ANT_HOME%/bin