Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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
Author

How to use generators in Composite-id

Venkat dasari
Ranch Hand

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


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

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: http://aspose.com/file-tools
 
subject: How to use generators in Composite-id
 
Similar Threads
Use of set tag in Hibernate mapping file for foreign key
Foreign key must have same number of columns as the referenced primary key
Sequnce in hibernate
Hibernate Mapping problem because no primary key in database
Hibernate: Foreign key must have same number of columns as the referenced primary key