-->
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.  [ 3 posts ] 
Author Message
 Post subject: A multi-column unique constraint
PostPosted: Wed Nov 02, 2005 1:36 am 
Newbie

Joined: Tue Nov 01, 2005 2:48 am
Posts: 2
hi guys:
In a table i want to map using hibernate, there is a business key made of two columns. Considering database issues, the table should have a composite unique constrains.
The issue is that should i use a composite properties mapping in mapping file, for example:

<properties name="keyPair"
unique="true">
<property
name="keyword"
type="string"
update="true"
insert="true"
column="KEYWORD"
not-null="true"
/>
<property
name="serviceNumber"
type="string"
update="true"
insert="true"
column="SERVICE_NUMBER"
not-null="true"
/>
</properties>
after doing that, i have to refer column keyword in hql like this:
className.keyPair.keyword.
I think that this is boring just to make a composite unique declaration.
thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 02, 2005 1:57 am 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
I don't know what you mean but maybe the stuff I told someone else an hour ago can be of help.

http://forums.hibernate.org/viewtopic.p ... 28882591d1


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 02, 2005 7:30 am 
Beginner
Beginner

Joined: Mon May 02, 2005 6:17 pm
Posts: 41
You should make a composite-id declaration. There is nothing more exciting than that :)

_________________
www.globalresearch.ca


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.