Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Volodymyr Lysenko
Ranch Hand
Posts: 511
1
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
James Sutherland
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Volodymyr Lysenko
Ranch Hand
Posts: 511
1
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic