• Post Reply Bookmark Topic Watch Topic
  • New Topic

Using generator with composite keys in hibernate  RSS feed

 
kalai sundar
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Can you please elaborate on how the <generator> will be used for composite PK?. In my situation XYZ_REQUEST_ID needs to be auto-generated from xyz.sequence_application_id sequence, and XYZ_REQUEST_SITE_ID is a foreign key .
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Basically you define a generator to use and Hibernate will pick up a value for a primary key from that. In your case you have a sequence to use, so the generator will just get the next value form there. Have a read of the documentation for a fairly detailed explanation.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!