Issue Type: Bug Bug
Affects Versions: 4.1.8
Assignee: Unassigned
Components: core
Created: 12/Nov/12 10:01 AM
Description:

Since version 4.1.8 of hibernate core it is not possible to generate any unique constraint using schema exporter. Columns marked as unique are not generated as unique any more (independent if they are nullable or not!!).

E.g. following mapping
<property name="myName" column="MYNAME" type="string" length="4096" access="field" unique="true" not-null="true" />
is now generated as

create table xxx (
...
MYNAME varchar(4096) not null,
primary key (ID)
);

In hibernate version 4.1.7 it was correctly generated as:

create table xxx (
...
MYNAME varchar(4096) not null,
primary key (ID),
unique (MYNAME)
);

Same is true if I set column to be Nullable:
<property name="myName" column="MYNAME" type="string" length="4096" access="field" unique="true" not-null="false" />

It seems that the logic regarding the combination of the two flags column.isNullable() and dialect.supportsNotNullUnique() is not consistent between the operations Table.sqlCreateString() and UniqueKey.sqlConstraintString() !!!

Environment: Hibernate Core 4.1.8
HSQLDB 2.2.9
Project: Hibernate ORM
Priority: Major Major
Reporter: Andreas Falk
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