Hi,
I have following mapping files :
B.hbm.xml :
=========
<hibernate-mapping>
<class name="B" table="B_table">
<id column="id" type="int" unsaved-value="none">
<generator class="hilo"/>
</id>
<discriminator column="disc"/>
<property name="i" type="int" column="i"/>
<property name="s" type="string" column="s"/>
</class>
</hibernate-mapping>
A.hbm.xml :
=========
<hibernate-mapping>
<subclass name="A" extends="B">
<property name="f" type="float" column="f"/>
</subclass>
</hibernate-mapping>
Then I want to build db schema with the ant task :
<schemaexport properties="${conf.file}">
<fileset dir="${class.dir}">
<include name="**/*.hbm.xml"/>
</fileset>
</schemaexport>
I got the following error :
Schema text failed: net.sf.hibernate.MappingException: Cannot extend unmapped class B
SchemaExport read *.hbm.xml files sequentially.
It first reads A.hbm.xml and say it doesn't know B mappings. It doesn't try to read B.hbm.xml.
If I rename A.hbm.xml to C.hbm.xml, it works!
|