-->
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.  [ 7 posts ] 
Author Message
 Post subject: 3/4 columns "together" need to be unique
PostPosted: Fri May 28, 2004 11:15 pm 
Beginner
Beginner

Joined: Thu Feb 19, 2004 6:07 am
Posts: 21
Hi there,

I have a small question. Supposing I wanted to make three/four
columns in a table unique - i.e 3/4 columns "together" need to be
unique. How do I declare the mapping for it ?

TIA,
sanjeev.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 28, 2004 11:57 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Use composite key mapping:

see http://www.hibernate.org/hib_docs/reference/en/html/mapping.html#mapping-declaration-compositeid


Top
 Profile  
 
 Post subject: composite key extra column ?
PostPosted: Sat May 29, 2004 12:09 am 
Beginner
Beginner

Joined: Thu Feb 19, 2004 6:07 am
Posts: 21
Thanks for the prompt reply.
I am aware of compoosite keys which means
I need another column as the composite key column.
Can I not avoid having another column.
Or better still can I use the primary key as the composite key?
Hope I was articulate enough.
TIA,
sanjeev.


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 29, 2004 12:16 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
I'm sorry I don't understand what you after.
How about showing an outline of the table definition and decrible what columns need to be unique.


Top
 Profile  
 
 Post subject: um - sorry
PostPosted: Sat May 29, 2004 12:16 am 
Beginner
Beginner

Joined: Thu Feb 19, 2004 6:07 am
Posts: 21
Hi
After reading the doco properly - came to the
conclusion that I don't really need another column.
I can simply bunch the 3/4 columns and declare a
composite key on them.
Am I correct ?

TIA,
Sanjeev.


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 29, 2004 12:23 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Yes.


Top
 Profile  
 
 Post subject: thanks.
PostPosted: Sat May 29, 2004 12:26 am 
Beginner
Beginner

Joined: Thu Feb 19, 2004 6:07 am
Posts: 21
hmm...thanks.
Problem solved for the moment.
Thanks again.


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