Senior |
|
Joined: Mon Oct 23, 2006 5:12 am Posts: 141 Location: Galicia, Spain
|
Hibernate version: 3.2
Hi, in section 8.2 (Collections of dependent objects) we can see:
<set name="someNames" table="some_names" lazy="true">
<key column="id"/>
<composite-element class="eg.Name"> <!-- class attribute required -->
<property name="initial"/>
<property name="first"/>
<property name="last"/>
</composite-element>
</set>
My question is: can i define an unique-key fomed by the "id" and the "initial" columns on the join table "some_names"?
I've tried with no luck:
<set name="someNames" table="some_names" lazy="true">
<key column="id"/ unique-key="key1">
<composite-element class="eg.Name"> <!-- class attribute required -->
<property name="initial" unique-key="key1"/>
<property name="first"/>
<property name="last"/>
</composite-element>
</set>
With this config Hibernate complains:
Error parsing XML: XML InputStream(28) Attribute "unique-key" must be declared for element type "key".
Is there any easy way of achieving what i'm looking for?
_________________ andresgr (--don't forget to rate)
|
|