wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes Table-per-class mapping restrictions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Table-per-class mapping restrictions" Watch "Table-per-class mapping restrictions" New topic
Author

Table-per-class mapping restrictions

Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3476

Hi.
Table-per-class inheritance mapping with JPA doesn't allow the usage of AUTO and IDENTITY for ID generation.
Would you please shed more light on this restriction?
Why SEQUENCE is allowed?
Thanks.
Edvins Reisons
Ranch Hand

Joined: Dec 11, 2006
Posts: 364
With this strategy, the generated ID values must be unique over all the tables used for the inheritance hierarchy. A sequence can do this nicely;
apparently, the other methods can't.
Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3476

That is exactly what I don't understand...
Suppose I have two tables:
FancyTable and AmazingTable, each table has ID column.
If ID column of FancyTable contains values (1, 3, 7), this means ID column of Amazing table can't hold values (1, 3, 7)?
Edvins Reisons
Ranch Hand

Joined: Dec 11, 2006
Posts: 364
Yes, if they are mapped within the same hierarchy.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Table-per-class mapping restrictions
 
Similar Threads
Column 'id0_' not found Error
GRAILS, GORM custom mapping subclass in existing database.
Hibernate @DiscriminatorColumn
Inheritance mapping in hibernate?
Best inheritance mapping strategy..