I'm having trouble setting up hibernate to work with my program.
It's a stand-alone java application that accesses a postgresql database (previously through Torque, and I'm now trying to refactor it to use hibernate instead).
I used the xdoclet hibernate task to create the .hbm.xml files, but when I try to generate the schema, it fails saying it can't find the class files.
I've checked my classpath over and over, and have tried multiple ways of specifying it but still nothing.
The xdoclet task is defined like this:
<target name="db-xdoclet" depends="prepare" description="Generates Hibernate class descriptor files.">
<taskdef classname="xdoclet.modules.hibernate.HibernateDocletTask"
classpathref="path.self" name="hibernatedoclet"
/>
<hibernatedoclet
destdir="${dir.work.build}"
excludedtags="@version,@author,@todo"
force="true"
verbose="true"
mergedir="${dir.work.build}"
>
<fileset dir="${dir.src.java}">
<include name="**/*.java"/>
</fileset>
<hibernate version="2.0"/>
</hibernatedoclet>
</target>
It generates the .hbm.xml files fine. However when I run this task:
<target name="db-schema" depends="prepare">
<taskdef classname="net.sf.hibernate.tool.hbm2ddl.SchemaExportTask"
name="schemaexport" classpathref="path.self"/>
<schemaexport delimiter=";" drop="false" output="${dir.work.sql}/schema.sql"
properties="${dir.work.conf}/hibernate.properties" quiet="false" text="false">
<fileset dir="${dir.work.build}">
<include name="**/*.hbm.xml"/>
</fileset>
</schemaexport>
</target>
It fails:
[schemaexport] 2004-06-08 21:15:32,718 [main] ERROR net.sf.hibernate.cfg.Configuration - Could not compile the mapping document
[schemaexport] net.sf.hibernate.MappingException: persistent class [org.blah.data.BackupFile] not found
The classpath path.self is defined as follows:
<path id="path.self">
<fileset dir="${dir.lib}" >
<include name="**/*.jar" />
</fileset>
<fileset dir="${dir.build.lib}" >
<include name="**/*.jar" />
</fileset>
<pathelement path="${dir.src.java}"/>
<pathelement path="${dir.work.java}"/>
</path>
It's the same path I use for the javac task, which works perfectly.
Is there something I'm missing? This is with Hibernate 2.1.4 btw.
|