A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Android Security Essentials Live Lessons
this week in the
Object Relational Mapping
How to use generators in Composite-id
Joined: Nov 12, 2003
Dec 20, 2004 06:22:00
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,
Regards,<br />Venkat Dasari<br />SCJP 1.4, SCBCD.
Joined: Apr 14, 2004
Dec 20, 2004 07:11:00
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?
It is sorta covered in the
JavaRanch Style Guide
subject: How to use generators in Composite-id
Foreign key must have same number of columns as the referenced primary key
Use of set tag in Hibernate mapping file for foreign key
Hibernate: 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
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014