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!
|