aspose file tools*
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Table-per-class mapping restrictions