File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes Inheritence in JPA Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Inheritence in JPA" Watch "Inheritence in JPA" New topic

Inheritence in JPA

Satyajeet Kadam
Ranch Hand

Joined: Oct 19, 2006
Posts: 215
Q1) I am confused with names? By how many names each one reffered?

1) Table per class hierarchy or Single table or Single Table Inheritance // Are these names are correct?Do they mean the same thing?
Data is store in one table.
lot of null able columns

2) Table per Subclass or Joined Inheritance
parent child relationship is established
No null able column

3) Table per class or table per concrete class

Each class has its own table
Parent fields get duplicated in table
Data gets repeated again and again

James Sutherland
Ranch Hand

Joined: Oct 01, 2007
Posts: 553
Sounds about right.

For #3, no data is duplicated, only columns. Each instance is only stored in one of the tables.

TopLink : EclipseLink : Book:Java Persistence : Blog:Java Persistence Performance
It is sorta covered in the JavaRanch Style Guide.
subject: Inheritence in JPA