• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

I'm confused about pkColumnValue parameter

 
Luk Cora
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm following this guide http://www.developer.am/ejb3/?page=generating-primary-keys

There is an example of generated table (throught strategy method):


and i will have

SEQUENCE_NAME
CUST_SEQ

SEQUENCE_COUNT
0


After it say
If we want to store several sequences in the same sequence table, for example a separate sequence for each entity, then we need to manually specify the pkColumnValue element. The following statement sets the pkColumnValue to customer_seq:

@TableGenerator(name="CUST_SEQ", table="SEQUENCE_TABLE", pkColumnName="SEQUENCE_NAME", valueColumnName="SEQUENCE_COUNT", pkColumnValue="CUSTOMER_SEQ")

What the purpose of manually set a primary key considering that i can't have duplicate values??
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic