-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: schemaexport error with inheritance mapping
PostPosted: Wed Apr 21, 2004 11:01 am 
Newbie

Joined: Mon Apr 19, 2004 12:55 pm
Posts: 6
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!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.