|
Re: Inheritance with multiple subclasses [message #629861 is a reply to message #629786] |
Wed, 29 September 2010 18:58 |
Chris Delahunt Messages: 1389 Registered: July 2009 |
Senior Member |
|
|
Hello,
I'm not sure I follow what you are trying to do. You have 3 tables, but does that mean for every entry in the Person table you must have a corresponding entry in both the Employee and User tables? Or is it just that a User will have an entry in the user table and Person table, and an employee will have an entry in Employee and Person?
If it is the first, it doesn't sound like java inheritance at all. You just need 1 object type and map it over the 3 tables using the secondarytable annotation. If it is the second, map a Person entity/superclass to the Person table as shown here:
http://wiki.eclipse.org/EclipseLink/Examples/JPA/Inheritance #Annotations
If it is that the 3 are independent -ie a Person can have both a row in the User and Employee tables but doesn't have to, you might want to try something different such as mapping the User and Employee tables as their own entities and having the Person reference them with a 1:1 mapping.
Best Regards,
Chris
[Updated on: Wed, 29 September 2010 19:01] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02363 seconds