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: Mapping one column to different classes (no tables)
PostPosted: Tue Nov 20, 2007 5:11 am 
Newbie

Joined: Tue Nov 20, 2007 4:57 am
Posts: 7
I have the following issue that I don't know how to map:

Class R, that contains a list of objects of type P (R maps to a table in the database)
Class P, with a many to one relationship to R and an object of type A (P maps to a table in the database)

Class A is a abstract class that is extended by a number of classes (A does not map to a table in the database).
In the database, the table for P would look like:
Id - R_Id - AString
where AString determines which class that derives from A should be instantiated for an object of type P

This would be a simple mapping if A had had a table behind it (using discriminator/subclass), but I don't know how to do it without a table behind. I've read a bit about using UserType, but I am not sure that is the solution as I couldn't find an example where hibernate would make a choice as to which subclass of A should be instantiated


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.