-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: XDoclet tags for tricky value map with a unique constraint?
PostPosted: Sat Feb 19, 2005 8:20 pm 
Newbie

Joined: Sat Jan 10, 2004 10:06 pm
Posts: 9
Location: Calgary, AB, Canada
Hi All,

This may be slightly off topic but most Hibernate users are also XDoclet users I think?

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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.