Loading...

hibernate-users@lists.jboss.org

[Prev] Thread [Next]  |  [Prev] Date [Next]

[hibernate-users] Unique key constraint Ankita Patil Fri Nov 11 09:00:53 2011

Hi,
I already have an id as the primary key for the table say XYZ.

Now, I want to set a field or a combination of two fields as a unique key
so that when i try to save say 2 entries in the DB with same value for the
unique key field then only one entry should be made in the table with one
primary key. I want hibernate to handle it internally and not throw me an
exception.

Now i have only one auto-generated primary key and when i try to save 2
entries in the DB with same value for the unique key field it stores
duplicate entries.

Is it possible? If yes how?

Thanks in advance
Ankita
_______________________________________________
hibernate-users mailing list
[EMAIL PROTECTED]
https://lists.jboss.org/mailman/listinfo/hibernate-users