Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Generating PK

 
Deepika Joshi
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
EJB 3 in Acion , page 268

I am not sure where we keep (in which entity/class) the following code

- @SequenceGenerator (name="U_seq_Gen", sequenceName = "U_Seq", initialValue=1, allocationSize=10)
- @TableGenerator (name="User_t_gen", tableName="SeqG_T", pkColumnName="SEQ_Name", valueColName="SEQ_Val", pkColumnValue="U_SEQ")

plseae suggest...

thanks...

 
Raf Szczypiorski
Ranch Hand
Posts: 383
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can keep it as an entity annotation, or directly on an id field / property. It is scoped to a whole persistence-unit anyways.
 
Deepika Joshi
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks....
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!