I'm using hbm2java ant task from HibernateTools 3.1.0 beta 4.
I have some hibernate objects that reference other hibernate objects that I do not want to generate. However, this isn't working.
My ant task is as follows with hibernatetool setup with a class path to include all needed files.
If I do the following, I get an error (notice separate project's Hbm files referenced in classpath).
Code:
<target name="codegen >
<hibernatetool destdir="srcgen">
<classpath>
<dirset dir="../otherhibproj/src"/>
</classpath>
<configuration>
<fileset dir="src">
<include name="**/*Hbm.xml"/>
</fileset>
</configuration>
<hbm2java jdk5="false" ejb3="false"/>
</hibernatetool>
</target>
[hibernatetool] BUILD FAILED: org.hibernate.MappingException: An association from the table CODES refers to an unmapped class: com.otherhibproj.hib.ObjectImpl
BUILD FAILED:
If, I however move the referenced Hbm file into the configuration, it works.
Code:
<target name="codegen >
<hibernatetool destdir="srcgen">
<configuration>
<fileset dir="src">
<include name="**/*Hbm.xml"/>
</fileset>
<fileset dir="../otherhibproj/src">
<include name="**/*Hbm.xml"/>
</fileset>
</configuration>
<hbm2java jdk5="false" ejb3="false"/>
</hibernatetool>
</target>
I have tried a variety of different methods of including the referenced Hbm file in the classpath, but to no avail. Am I doing something wrong, or does hbm2java require you to rebuild ALL java objects.
Thanks