-->
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 when mapping an association with class inheritance
PostPosted: Sun Apr 03, 2005 11:26 am 
Newbie

Joined: Wed Jan 26, 2005 8:05 am
Posts: 13
Hi Guys,
I have a problem when trying to map associations in class inheritance.
Imagine, I have a Class A which has two set associations
one with Class B and one with Class C.

Classes B and C are mapped to the same relation table.
This represents a table per class hierarchy, since Class C extends
Class B. The two classes have a references to the Class A.

So, when I load instances of Class A I want to have two
sets in the instance, one populated with instances of Class B,
the other populated with instances of Class C.

The problem is that when I try to load instances of Class A, I get :
org.hibernate.WrongClassException: Object with id: 1 was not of the specified subclass:......

This is because in the mapping of Class A the one set relation is mapped to the subclass C
and the other is mapped to its superclass B.
I do this because I want each set be populated only with the class it is mapped to.

Do you have any suggestions how could I get the result I want, i.e.
the each set in the Class A be populated only with one type of instances.

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.