Joined: Sat Jan 10, 2004 10:06 pm Posts: 9 Location: Calgary, AB, Canada
|
Hi All,
I have a simple key/value set that I wish to persist as a map associated with a persistent object. That in itself is absolutely straightfoward mapping expressed as a map backed collection-of-values (thanks again Hibernate dudes!!!). And the XDoclet tag setup is also trivial for this simple case.
The one twist I have is I want to declare that the key/value pairs form a unique key in the database. The Hibernate mappings provide the <column> tag to use instead of column attributes in the relevant fields to construct the unique constraint. Again, this is not hard to set up if I write the mapping by hand (see below), but does anyone have a suggestion on how I can configure XDoclet to produce the same? I have tried various combinations of @hibernate.column without success.
To be clear, here is the mapping I wish to generate (note the explicit column elements declaring the unique-key):
<map
name="mulitKeys"
table="ANIMAL_MULTIKEY"
lazy="false"
sort="unsorted"
inverse="false"
cascade="all"
>
<key>
<column name="CA_ID" unique-key="ANIMAL_MULTIKEY_UNIQUE"/>
</key>
<index type="string">
<column name="NAME" unique-key="ANIMAL_MULTIKEY_UNIQUE" length="32"/>
</index>
<element type="string" not-null="false">
<column name="VALUE" unique-key="ANIMAL_MULTIKEY_UNIQUE" length="32"/>
</element>
</map>
Many thanks for any suggestions brought forward. Looking forward to Hibernate 3!
Jay
|
|