-->
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.  [ 2 posts ] 
Author Message
 Post subject: Hibernate mapping more than one unique-key for same column
PostPosted: Fri Dec 01, 2006 3:24 pm 
Newbie

Joined: Fri Dec 01, 2006 2:59 pm
Posts: 2
How do I define hibernate mapping if I have more then one unique-key for the same field ie if I want to generate DDL with two unique constrain For eg. I have unique constrain for type and key2 fields defined by unique-key="key2type". If I also want to define unique constrain for type and key1 field how do I write it.
I want to write hibernate mapping so that I can generate DDL with 2 unique constrain. Unique (key1,type) and also Unique(key2,type)
Any help will be appreciated


<many-to-one name="type" class="com.db.Type">
<column name="type" index="key2type" unique-key="key2type"/>
</many-to-one>


<property name="key1" type="string">
<column name="key1" index="key1"/>
</property>


<property name="key2" type="string">
<column name="key2" index="key2" unique-key="key2type" not-null="true"/>
</property>


Last edited by swarnim on Sat Dec 02, 2006 12:11 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 02, 2006 7:51 am 
Newbie

Joined: Mon Jan 05, 2004 11:04 am
Posts: 16
Hi,

try
<natural-id>
for business keys

_________________
_________________
Siegbert

Please don't forget to give credit if/when you get helpful information.


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

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.