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

How to use generators in Composite-id

 
Venkat dasari
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
My problem is.... I have a composite key out of which one is a sequence generator.How to declare this in my mapping file. let me give an example...

In a normal table with one primary key Id declaration in the mapping file will suffice as a primary key declaration. And a generator tag will make it more easier for auto generation of values.

Now if the table has a composite-key. One of the key attribute must be from a sequence generator. How to describe this in a mapping file..

Please do inform me about this...


thanks in advance,
Venkat Dasari
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are you using a sequence as part of a composite-id? Your sequence will be generating unique values so why not just use that?
 
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!