Joined: Wed May 11, 2005 3:05 am Posts: 2 Location: Australia
|
Hibernate version: 3.03
Hi Guys,
Is it possible to define a composite primary key association? I know that I can do this using a simple key.
I have a class Foo that has a composite primary key of the form:
<composite-id>
<key-property name="id1" ..." />
<key-property name="id2" ..." />
</composite-id>
Foo composes another object called Bar. In the DBMs Bar has a foreign key back to the Foo composite primary key
Class Foo {
long id1;
long id2;
Bar data
}
Class Bar
long id1;
long id2;
...
String detail;
}
I cannot seem to find a way to add the one-to-one associations using the
composite key.
Also is there any way to configure the Bar ID so that it is set to the same value as the Foo primary key on a save?
thanks,
Lara
|
|