File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes How to use generators in Composite-id Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "How to use generators in Composite-id" Watch "How to use generators in Composite-id" New topic

How to use generators in Composite-id

Venkat dasari
Ranch Hand

Joined: Nov 12, 2003
Posts: 67
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

Regards,<br />Venkat Dasari<br />SCJP 1.4, SCBCD.
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

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?

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
I agree. Here's the link:
subject: How to use generators in Composite-id
It's not a secret anymore!