We have an existing and working database created from hbm mapping files.
We want to create some new tables for an optional feature.
One option is that these new tables always exist but we would prefer for the tables and POJOs to only be created on request.
My issue is that these tables/POJOs have dependancies on existing tables/POJOs. I have created a mapping file but I can only get it to work if it creates create/drop commands for the existing tables as well as the new ones, along with their POJOs as well.
Can I avoid this existing table/POJO for Group appearing in the creation script.
In the example below Group is an existing table/POJO.
<id name="id" type="java.lang.Long">
<column name="ID" not-null="true" />
</id>
<many-to-one name="group"
class="uk.co.foo.domain.dfwv.Group"
foreign-key="GROUP_FK" lazy="false" not-found="ignore">
<meta attribute="use-in-tostring">false</meta>
<column name="GROUP_NAME"
not-null="true" />
</many-to-one>
</class>
The ant target to generate this is below and only works if the dependant objects are listed:
<fileset dir="${dfwv.mappings.dir}">
<include name="**/groups.hbm.xml" />
</fileset>
</configuration>
<hbmtemplate exporterclass="uk.co.foo.hibernateutils.tools.Exporter" templateprefix="config/foopojo/" template="config/foopojo/Pojo.ftl">
<property key="jdk5" value="true" />
<property key="ejb3" value="false" />
</hbmtemplate>
</hibernatetool>
</target>
Without the dependant reference to Group then I get the error:
BUILD FAILED C:\projects\foo\db-build.xml:187: Schema text failed: An association from the table DISCON_TEST refers to an unmapped class: uk.co.foo.domain.dfwv.Group
Hibernate version:3.1.2