-->
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: Problem with mapping association
PostPosted: Tue Apr 05, 2005 1:33 pm 
Newbie

Joined: Wed Jan 26, 2005 8:05 am
Posts: 13
Hi Guys,
I have the following problem.
I have a class A which has two associations one to many associations
with classes B and C.
I use a List object to handle these associations.
The classes B ans C are mapped to the same table. They both
extend class D.
In the mapping xml file of class A I have the following entries

<bag name="ListB" inverse="true" cascade="all-delete-orphan" outer-join="true">
<key column="id"/>
<one-to-many class="bla.bla.classD"/>
</bag>

<bag name="ListC" inverse="true" cascade="all-delete-orphan" outer-join="true">
<key column="id"/>
<one-to-many class="bla.bla.classD"/>
</bag>


As you can see the one-to-many associations for both the lists is mapped to the class D, which is the superclass of B and C.
So when I load my object A I got two lists which are filled in with the same instances of class B and C.

How could I make it possible for the two lists to be filled in with only one
type of class : ListB with instances of class B only and ListC with instances of classC only.

If I try to map each one-to-many association relation with the concrete class type, classB for ListB and classC for List C I got:

org.hibernate.WrongClassException: Object with id: 1 was not of the specified subclass:......

Do you have any suggestions how could I make it work ?

I use Hibernate 2.1 and JDK 1.3.

Thank you.
Skyrose.


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.