• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Non-disjoint inheritance?

 
Karsten Wutzke
Ranch Hand
Posts: 106
Hibernate MySQL Database Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can Hibernate and/or another Java ORM handle non-disjoint inheritance, that is, inheritance without a discriminator column?

I put up a question and an example here:

http://stackoverflow.com/questions/4149920/how-does-the-jpa-handle-partial-non-disjoint-inheritance-using-inheritancetype

I think it isn't possible in plain JPA, maybe Hibernate and/or another Java ORM can do it via proprietary annotations?

Karsten
 
James Sutherland
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See,

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

EclipseLink supports this through a @ClassExtractor annotation that lets you specify your own code to determine the class form the row.
 
Karsten Wutzke
Ranch Hand
Posts: 106
Hibernate MySQL Database Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply. Unfortunately, the ClassExtractor annotation must implement another abstract ClassExtractor class.

http://www.eclipse.org/eclipselink/api/2.1/org/eclipse/persistence/annotations/ClassExtractor.html

This is possible in my example, but not in my real DB design.

Karsten
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic