]
Vincent Ricard updated HBX-1067:
--------------------------------
Issue Type: Patch (was: Bug)
[SchemaExport] Duplicate unique constraint with
unique="true" and natural-id
----------------------------------------------------------------------------
Key: HBX-1067
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HBX-1067
Project: Hibernate Tools
Issue Type: Patch
Affects Versions: 3.2.0.GA
Environment: Hibernate 3.2.5, MySQL 5.0.51 (InnoDB), Java 1.5
Reporter: Vincent Ricard
Priority: Minor
Attachments: HBX-1067.patch
In my foo.hbm.xml, if i put this:
<natural-id>
<property name="barId" column="bar_id" not-null="true"
length="128"/>
</natural-id>
SchemaExport creates this:
create table foo (id bigint not null auto_increment, version integer not null, bar_id
varchar(128) not null, primary key (id), unique (bar_id)) ENGINE=InnoDB;
And MySQL creates only one index for bar_id.
But, if my foo.hbm.xml contains this:
<natural-id>
<property name="barId" column="bar_id" not-null="true"
unique="true" length="128"/>
</natural-id>
SchemaExport generates this:
create table foo (id bigint not null auto_increment, version integer not null, bar_id
varchar(128) not null unique, primary key (id), unique (bar_id)) ENGINE=InnoDB;
And MySQL creates 2 indices for bar_id.
So, i think it'd be cool if schemaexport was smarter (even if MySQL could be too).
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: