-->
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.  [ 2 posts ] 
Author Message
 Post subject: Many-to-One and inheritance mapping
PostPosted: Wed Apr 13, 2005 10:59 am 
Newbie

Joined: Thu Apr 07, 2005 12:18 pm
Posts: 6
Location: Toulouse, France
Hello !

Hibernate version: 3.0 final

I've a problem with inheritance mapping and many-to-one association.

Here is the inheritance diagram :
Code:
                     <== IntegerValue
AbstractValue
                     <== TextValue



Mapping strategy : table per class hierarchy (joined-subclass).


If I use session.createQuery(...), I got the correct class (that's to say IntegerValue or TextValue ). So the mapping seems to be correct.


Meanwhile, this mapping is used in a "many-to-one association" :

Code:
       1..n
Attribute -------- AbstractValue


Mapping for Attribute :
Code:
<many-to-one
         name="IdAbstractValue"
         class="AbstractValue"
         not-null="true"
         cascade="save-update"
      >
         <column name="id_value"/>
</many-to-one>


If I load an Attribute, I got an AbstractValue and not one of its child class...


An idea ??

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 13, 2005 11:05 am 
Newbie

Joined: Thu Apr 07, 2005 12:18 pm
Posts: 6
Location: Toulouse, France
Oups, the mapping strategy is not "table per class hierary" but a table per subclass...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.