File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
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?
I agree. Here's the link:
subject: How to use generators in Composite-id
Sequnce in hibernate
Hibernate: Foreign key must have same number of columns as the referenced primary key
Foreign key must have same number of columns as the referenced primary key
Hibernate Mapping problem because no primary key in database
Use of set tag in Hibernate mapping file for foreign key
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015