Hi Max, thanks for the help. I've got it working and reverse engineering the DB now so can now get started.
I do think that a short tutorial or something would help in the documentation. For example, there's nowhere that says that after you download and extract the tools plugin, to actually get it to work in eclipse or command line with ant, you need to extract the org.hibernate.eclipse_3.1.0.alpha5.jar itself. Also the documentation is not complete with the dependencies in the classpath. I would think that getting ant working was fundamental and therefore to make it a complete plugin... etc etc. However, I have it working and really appreciate your help.
For anyone else who's maybe struggling, this is what I did.
Install Eclipse.
Download and extract to the eclipse plugins the Hibernate Tools.
Go into the eclipse plugins directory and extract the org.hibernate.eclipse_3.1.0.alpha5.jar to c:/eclipse/plugins/org.hibernate.eclipse_3.1.0.alpha5
Create the hibernate.cfg.xml
Create the DB
Then I used this build script (it has a few other things in it but the important one is the reverse engineer)
Code:
<?xml version="1.0"?>
<project name="$project.name" default="reverse.engineer">
<property file="${basedir}/build.properties"/>
<description>
The freewave application
</description>
<path id="compile.classpath">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
</path>
<path id="hibernate.classpath">
<fileset dir="${hibernate.plugin.dir}">
<include name="**/hibernate-tools.jar"/>
<include name="**/velocity-1.4.jar"/>
<include name="**/velocity-tools-generic-1.1.jar"/>
<include name="**/jtidy-r8-21122004.jar"/>
<include name="**/hibernate3.jar"/>
<include name="**/ehcache-1.1.jar"/>
<include name="**/commons-collections-2.1.1.jar"/>
</fileset>
<fileset dir="${mysql.connector.dir}">
<include name="**/mysql-connector-java-3.1.10-bin.jar"/>
</fileset>
<fileset dir="${lib.dir}">
<include name="**/commons-logging.jar"/>
<include name="**/dom4j-1.6.1.jar"/>
</fileset>
</path>
<taskdef name="hibernatetool"
classname="org.hibernate.tool.ant.HibernateToolTask"
classpathref="hibernate.classpath">
</taskdef>
<target name="default" depends="create.database" description="Builds the lot">
</target>
<target name="clean" depends="" description="">
<delete dir="${generated.dir}" />
</target>
<target name="prepare" depends="" description="">
<mkdir dir="${generated.classes.dir}" />
<mkdir dir="${generated.src.dir}" />
</target>
<target name="compile" depends="" description="">
<javac classpathref="compile.classpath"
srcdir="${basedir}/src"
destdir="${generated.classes.dir}" />
</target>
<target name="create.database" depends="" description="Builds the database">
<sql driver="${db.driver}"
password="${db.password}"
src="${db.dir}/create.sql"
url="${db.url}"
userid="${db.user}"
classpath="${db.driver.classpath}">
</sql>
</target>
<target name="reverse.engineer" depends="prepare" description="Creates the DTO's from the Database">
<hibernatetool destdir="${generated.src.dir}">
<classpath>
<path id="hibernate.runtime.classpath">
<fileset dir="${hibernate.plugin.dir}">
<include name="**/velocity-tools-generic-1.1.jar"/>
</fileset>
</path>
</classpath>
<jdbcconfiguration configurationfile="${config.dir}/hibernate.cfg.xml"/>
<hbm2java ejb3="false" />
</hibernatetool>
</target>
</project>
I have this properties file which may be of use too
Code:
project.name=Freewave
eclipse.dir=C:/eclipse
eclipse.plugin.dir=${eclipse.dir}/plugins
src.dir=${basedir}/src
lib.dir=${basedir}/lib
config.dir=${basedir}/config
generated.dir=${basedir}/generated
generated.classes.dir=${generated.dir}/WEB-INF/classes
generated.src.dir=${generated.dir}/src
db.dir=${basedir}/db
db.driver=com.mysql.jdbc.Driver
db.driver.classpath=C:/mysql-connector-java-3.1.10/mysql-connector-java-3.1.10-bin.jar
db.url=jdbc:mysql\:\/\/localhost\:3306\/freewave?autoReconnect=true
db.password=tomcat
db.user=tomcat
test.dir=${basedir}/test
hibernate.dir=C:/hibernate-3.1
hibernate.plugin.dir=${eclipse.plugin.dir}/org.hibernate.eclipse_3.1.0.alpha5
hibernate.plugin.tools.dir=${hibernate.plugin.dir}/lib/tools
hibernate.plugin.hibernate.dir=${hibernate.plugin.dir}/lib/hibernate
mysql.connector.dir=C:/mysql-connector-java-3.1.10