[hibernate-issues] [Hibernate-JIRA] Commented: (HBX-1104) MySql index duplication

Hugh Daschbach (JIRA) noreply at atlassian.com
Mon Jan 19 20:12:38 EST 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HBX-1104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=32160#action_32160 ] 

Hugh Daschbach commented on HBX-1104:
-------------------------------------

Suppressing duplicate index generation, as suggested above, causes hbm2ddl to attempt to explicitly create indexes with the same name used in the existing schema, leading to "Duplicate key name" errors.  The patch attached to http://opensource.atlassian.com/projects/hibernate/browse/HHH-3722 fixes this issue.

> MySql index duplication
> -----------------------
>
>                 Key: HBX-1104
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-1104
>             Project: Hibernate Tools
>          Issue Type: Bug
>          Components: reverse-engineer
>    Affects Versions: 3.2.0.GA
>         Environment: Hibernate 3.2, MySql 5.0, HibernateExt built from SVN revision 15749 (http://anonsvn.jboss.org/repos/hibernate/branches/Branch_3_2/HibernateExt).
>            Reporter: Hugh Daschbach
>         Attachments: hibernate-tools.patch
>
>
> When I run hbm2ddl schema update, the reverse engineer process generates indicies and constraints that are already defined in the running schema.
> This looks much like http://opensource.atlassian.com/projects/hibernate/browse/HB-1114 and http://opensource.atlassian.com/projects/hibernate/browse/HB-1196.   So I risk submitting what may be regarded as a duplicate bug.  But I have an alternate solution to propose.
> I see the patch attached to HB-1196 in the hibernate-3.2 source code.  But I think this may be a band-aid over an issue in the reveng code.
> There seems to be two issues in JDBCBinder:bindOneToMany().  The first is that the new collection is created and passed to the secondPass processor whether  the associate foreign key exists or not.  The second is that the foreign key name is not associated with the keyValue attached to the new collection.
> The attached patch fixes both these issues and prevents creation of duplicate indexes for schema like that that describe in HB-1196.
> I don't know if this has any adverse implications for other dialects.  But I submit it because I think it's worth consideration.

-- 
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