-->
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: Mapping collections of derived types
PostPosted: Mon Jul 24, 2006 3:57 pm 
Newbie

Joined: Tue Apr 25, 2006 5:20 pm
Posts: 17
I was looking for a way to map collections of derived types where the foreign key for the collection resides in the PK of the base.

The following thread describes the situation. I'll quotes pieces here.
http://forum.hibernate.org/viewtopic.php?t=941990&highlight=joinedsubclass

dtabuenc said:
Quote:
I have ran into this problem as well. The problem is that there is no way to tell hibernate that the foreign key is in the base class. I haven't found a way to do this. Hibernate seems to ignore the inheritance relationship and blindly just always asumes that the foreign key is in the derived class' table.

I also want to know if this is considered a bug and if there is a good workaround to make collections of derived types using joined-subclass strategy.


Gavin goes on to say:
Quote:
Anyway, what you are trying to do seems utterly broken from a data modelling standpoint. My recommendation to people who want to do stuff like this is always: go buy a book and learn more about data modelling.


I don't understand how this is broken from a data modelling standpoint. Looks to be a standard Superclass/subclass situation.

Is the only work around to have a map collection of the base type then create a wrapper that iterates through the base collection then casts each one to the derived type?

Sorry, I am having trouble figuring this out. I will have to ditch Hibernate if i can't do this. Our database does this kind of superclass/subclass thing all over the place.

Christian


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 25, 2006 12:32 pm 
Newbie

Joined: Tue Apr 25, 2006 5:20 pm
Posts: 17
If this isn't possible with Hibernate, is there a pattern for working around these situations?


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.