-->
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.  [ 3 posts ] 
Author Message
 Post subject: inheritance
PostPosted: Wed Aug 03, 2005 1:10 pm 
Regular
Regular

Joined: Sun Jan 18, 2004 9:43 am
Posts: 50
Hi all


I implement the inheritance with table per-subclass method but I don't know how to express it in the mapping files.

If I use the following mapping file, during initialisation I got exception - net.sf.hibernate.MappingException: Resource: erp/dataaccesslayer/hibernate/dataobjects/MetalString.hbm.xml not found

But if I add a MetalString.hbm.xml file, I got exception - net.sf.hibernate.MappingException: duplicate import: MetalString.

How to fix this problem?? Is there a special mapping file for subclass?? Are there complete examples of the implementation of table per-subclass?



Hibernate version: 2.1.8

Mapping documents:

<class
name="erp.dataaccesslayer.hibernate.dataobjects.Fitting"
table="Fittings"
polymorphism="implicit"
>
<id
name="id"
type="java.lang.String"
column="id"
>
<generator class="assigned" />
</id>

<property
name="name"
type="java.lang.String"
column="name"
not-null="true"
length="50"
/>

<joined-subclass name="erp.dataaccesslayer.hibernate.dataobjects.MetalString" table="MetalString" >
<key column="id"/>

<property
name="weight"
type="double"
column="weight"
not-null="true"
/>

</joined-subclass>

</class>


_________________
Edmond Hung
Credit Card DNA Security System (Holdings) Ltd.


Top
 Profile  
 
 Post subject: hibernate.cfg
PostPosted: Wed Aug 03, 2005 1:36 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
Could it be that hibernate.cfg.xml has entry
<mapping resource="com/sourcelabs/demo/webapp/kernel/Company.hbm.xml"/>

And it should not be there.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 03, 2005 1:41 pm 
Senior
Senior

Joined: Wed Jul 13, 2005 4:31 pm
Posts: 142
Location: Seattle, WA
See the last entry for the post...

http://forum.hibernate.org/viewtopic.ph ... highlight=

there is an example there with separate files. Hope it helps.


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

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.