This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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


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: 3479

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: 3479

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.
 
Have you checked out Aspose?
 
subject: Table-per-class mapping restrictions
 
It's not a secret anymore!