File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Levytskyi
Ranch Hand

Joined: Mar 29, 2012
Posts: 505
    
    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 Levytskyi
Ranch Hand

Joined: Mar 29, 2012
Posts: 505
    
    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!!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to map entity from inheritance hierarchy to property in another entity?