-->
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: Mapping unique key question
PostPosted: Thu Oct 28, 2004 10:46 am 
Newbie

Joined: Wed Oct 27, 2004 5:07 pm
Posts: 1
Hibernate version: 2.1.6

Hi folks,

I have an object with four attributes (Atribute [type]):
id [long]
name1 [String]
name2 [String]
name3 [String]

I'd like to create a composite unique key, with the name1,name2,name3 attributes, because the concat of name1,name2 and name3 have to be unique. This is a silly thing to do if I go directly into the database, but I couldn't find how to make it in the mapping files.
How can I map this unique key constraint?

In SQL ANSI, I'd do:
ALTER TABLE
my_table ADD UNIQUE CONSTRAINT (name1,name2,name3);

Is there a way to make it work inside a mapping ?

Thanks!


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.