|
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
|