[hibernate-issues] [Hibernate-JIRA] Created: (HBX-1067) [SchemaExport] Duplicate unique constraint with unique="true" and natural-id
Vincent Ricard (JIRA)
noreply at atlassian.com
Thu Jun 19 07:11:33 EDT 2008
[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: Bug
Affects Versions: 3.2.0.GA
Environment: Hibernate 3.2.5, MySQL 5.0.51 (InnoDB), Java 1.5
Reporter: Vincent Ricard
Priority: Minor
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: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list