Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

composite-id in Hibernate

 
Ben Zaidi
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,

I have a database table Book where the primary key is basically a
composite key, which is like

ID + ISBN

If we use normal ID, we can auto-generate the id through sequence
or some other technique. But if we use the composite id mapping
like

Is there any way to generate the auto-sequence for ID in composite-id also?

Ben
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, no. But I would say if that id is generated and is unique, I would choose that as the Primary Key alone, you can still have the id and other field as a unique key in the database.

composite-id does not have a tag to say that one of its properties uses a sequence table.

Sorry

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic