There is, involving the hashing of composite keys that you need to do to have them, but you don't want to do go this route if you can avoid it. Composite keys have all sorts of warts, in Hibernate, and life. The least of them are, "What happens if the structure of your composite key changes??"
Do this:
Declare an "artificial key" for the table -- say an autonumbering (identity/native) primary key. Use this in hibernate as the id.
If it makes you feel better to have a "real key" defined, set unique constraint information on the business key field's you would normallly use (this is what I do).
I'm not quite the militant reciter of the "database keys should not be the business keys" mantra you normally find around here. If you have a lookup table with one field in it, then yeah, don't worry about making an artificial key for it.
HTH
-Joe
_________________ "A statistician is a mathmetician, broken down by age and sex".
|