简体   繁体   中英

About JPA TABLE_PER_CLASS and sub entity id

In the TABLE_PER_CLASS mapping,

does the sub entity id need be unique in all kind of sub entity instance

for example:
Employee : 1,2,3,4,5,6
Sales: 1,3,5
Developer: 2,4,6

or can be unique in it's table:

Employee : 1,1,2,2,3,3
Sales: 1,2,3
Developer: 1,2,3

I'm using MySQL, I have to create a table:hibernate_sequences to maintain the id unique in all sub enities, is there any information about this table's specification ?

I have googled, but cannot find information about this.

In the TABLE_PER_CLASS ( http://docs.oracle.com/javaee/6/tutorial/doc/bnbqn.html#bnbqs ) mapping each entity has its own table, so the ids dont have to be unique in the whole entity hierarchy. They have to be unique only in its table (so your second example is right)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM