The following issue has been updated:
Updater: Gavin King (mailto:ga...@in...)
Date: Thu, 25 Sep 2003 11:30 AM
Comment:
This is not actually a bug, the value just expresses a grouping. We actually generate the unique constraint into the CREATE TABLE, with no name at all. okay, I can see that it might be nicer to use the name, so I'm changing this to "improvement".
Changes:
type changed from Bug
---------------------------------------------------------------------
For a full history of the issue, see:
http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-346&page=history
---------------------------------------------------------------------
View the issue:
http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-346
Here is an overview of the issue:
---------------------------------------------------------------------
Key: HB-346
Summary: SchemaExport ignores user-specified unique index name
Type: Improvement
Status: Unassigned
Priority: Trivial
Project: Hibernate2
Components:
toolset
Versions:
2.0.3
Assignee:
Reporter: Robert Zhu
Created: Thu, 18 Sep 2003 7:32 PM
Updated: Thu, 25 Sep 2003 11:30 AM
Environment: Any
Description:
> robertz wrote:
I use SchemaExport to generate a mysql table called userandrole. The table has an internalId, which is the PK. It also has a unique key (index) comprising roleName and userName. The interesting thing is that this unique key generated for the table ignores the specified key name (key1). It uses the first column name of the composite key, ie, roleName. I am not sure if this is intentional or just a small bug in SchemaExport.
Below is the Hibernate descriptor file.
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class
name="com.abcd.persist.UserAndRole"
table="userandrole"
dynamic-update="false"
dynamic-insert="false"
>
<id
name="internalId"
column="internalId"
type="java.lang.Long"
>
<generator class="native">
</generator>
</id>
<property
name="roleName"
type="java.lang.String"
update="true"
insert="true">
<column name="roleName"
unique-key="key1"
length="200"
not-null="true"/>
</property>
<property
name="userName"
type="java.lang.String"
update="true"
insert="true">
<column name="userName"
unique-key="key1"
length="200"
not-null="true"/>
</property>
<property
name="creationDate"
type="java.util.Calendar"
update="true"
insert="true"
column="creationDate"
/>
</class>
</hibernate-mapping>
-------------------------------
> Christian Bauer replied:
The unique constraint name should be "key1". Please open a new JIRA issue.
---------------------------------------------------------------------
JIRA INFORMATION:
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
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
|