Neukomm created Bug HHH-8026
Issue Type: Bug Bug
Affects Versions: 4.1.10
Assignee: Unassigned
Attachments: duplicateconstraintnames.zip
Created: 22/Feb/13 4:04 AM
Description:

The fix for HHH-7797 changed the way unique constraints are generated. Unfortunately, if 'unique=true' is used in a property in the mapping, duplicate constraint names may be generated, which is not supported by most databases (tested with hsqldb 2.2.9, oracle 11g and mssql 2008R2).

I've created a junit test that works fine with hibernate-core 4.1.9 but fails with 4.1.10. You'll see error messages in the log when constraints are created and the ConstraintViolationException will not be thrown when creating the second object (although it should be thrown).

As far as I've seen there was nothing wrong with the way hibernate 4.1.9 (and also 4.1.7 and earlier) generated unique constraints. So unless there's an actual problem (other than code esthetics) that I'm not aware of, I'd suggest to revert those changes.

As a workaround, it is possible to use 'unique-key=<uniqueConstraintName>' instead of 'unique=true'.

Environment: windows xp, java 1.6.0_41, hsqldb 2.2.9, oracle 11g, mssql 2008R2
Project: Hibernate ORM
Priority: Major Major
Reporter: Neukomm
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira