Hi All
I am having a problem when generating hbm files according to a database structure. Hibernate calls it 'hibernate-reverse-engineering'
I have 2 tables TEST and TEST_1. Table TEST has a foreign key to table TEST_1. When I execute the following:
Code:
<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="projectClassPath" />
<hibernatetool destdir="generated/src">
<jdbcconfiguration configurationfile="hibernate.cfg.xml" revengfile="hibernate.reveng.xml" />
<hbm2java jdk5="true" ejb3="false" />
</hibernatetool>
I get an error org.hibernate.MappingException: An association from the table TEST refers to an unmapped class Test_1
If I update my hibernate.reveng.xml file so that the TEST_1 table is reverse engineered first then things work fine. It seams if you have a table TEST with a foreign key to another table TEST_1 then TEST table is analyzed first causing the error to be thrown because TEST_1 isnt mapped yet.
I beleive this to be a bug. If the mapping doesnt exist yet then jdbcconfiguration should create the missing mapping first then continue.
Anybody else got this problem?