I narrowed it down to some aspect of the ant task. I created another ant task that just ran CodeGenerator directly, and that worked fine, while the Hbm2JavaTask task still failed - everything else being identical. Here are my tasks:
<target name="generatejava" depends="init">
<taskdef
name="hbm2java"
classname="net.sf.hibernate.tool.hbm2java.Hbm2JavaTask"
classpathref="class.path" />
<hbm2java classpathref="class.path">
<fileset dir="${basedir}">
<include name="src/com/nathan/hibernatetest/User.hbm.xml" />
<include name="src/com/nathan/hibernatetest/Teacher.hbm.xml" />
</fileset>
</hbm2java>
</target>
<target name="runhbm2java" depends="init">
<java dir="${basedir}"
classpathref="class.path"
classname="net.sf.hibernate.tool.hbm2java.CodeGenerator">
<arg value="src/com/nathan/hibernatetest/User.hbm.xml"/>
<arg value="src/com/nathan/hibernatetest/Teacher.hbm.xml"/>
</java>
</target>
generatejava task fails with the previously posted error. runhbm2java runs perfectly. Still no clue if I'm doing something wrong, or there is a bug in Hbm2JavaTask.
Anyway, I have switched to Hibernate 3.0 and the Eclipse plugin for generating java source, and that seems to be working, also. So I have a workaround in Hibernate2, and no problems with Hibernate3. The reason I didn't switch to Hibernate 3.0 in the first place is because the tools are an alpha release, but they seem to be working great. Problem solved. Thanks, Hibernate Team, for a great product.
|