This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes How to map entity from inheritance hierarchy to property in another entity? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "How to map entity from inheritance hierarchy to property in another entity?" Watch "How to map entity from inheritance hierarchy to property in another entity?" New topic
Author

How to map entity from inheritance hierarchy to property in another entity?

Volodymyr Lysenko
Ranch Hand

Joined: Mar 29, 2012
Posts: 511
    
    1

Hello!

I have entity hierarchy with inheriatnce type SINGLE_TABLE :
The problem is how to map this JuniorUser entity and all its subclasses as property in Answer entity as :

Thank you!


True person is moral, false is right!
James Sutherland
Ranch Hand

Joined: Oct 01, 2007
Posts: 553
You don't need to do anything special, just map it the same way you map any relationship. You can use @OneToOne or @ManyToOne.

http://en.wikibooks.org/wiki/Java_Persistence/Inheritance


TopLink : EclipseLink : Book:Java Persistence : Blog:Java Persistence Performance
Volodymyr Lysenko
Ranch Hand

Joined: Mar 29, 2012
Posts: 511
    
    1

Thank yoy for reply!

You don't need to do anything special, just map it the same way you map any relationship. You can use @OneToOne or @ManyToOne.

This is true!!!
 
Have you checked out Aspose?
 
subject: How to map entity from inheritance hierarchy to property in another entity?
 
jQuery in Action, 3rd edition