[hibernate-issues] [Hibernate-JIRA] Created: (HBX-856) many-to-one with spaces in column name

Derek Price (JIRA) noreply at atlassian.com
Sat Jan 20 11:29:44 EST 2007


many-to-one with spaces in column name
--------------------------------------

         Key: HBX-856
         URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-856
     Project: Hibernate Tools
        Type: Bug

  Components: reverse-engineer  
    Versions: 3.2beta9    
 Environment: Hibernate Tools 3.2beta9, MySQL 5.0.27
    Reporter: Derek Price


When reverse engineering a database to mapping XML, when a column name which contains foreign keys to another table also contains spaces in its name, it ends up appearing twice in the mapping XML, once as:

<many-to-one name="ParentTableName" class="orm.ParentTableName" fetch="select">
            <column name="column name" />
</many-to-one>

and again as:

<property name="columnName" type="java.lang.Integer">
    <column name="`column name`">
        <comment></comment>
    </column>
</property>

This mapping generates similar POJOs which compile, but cause a run-time error about duplicate columns.  It looks like this is a simple quoting problem - I'm guessing that if the many-to-one column name attribute were quoted correctly, then the lookups would happen correctly and only the many-to-one entity would be created.


There is a related problem in reverse-engineering the parent class.  The mapping file for the parent class has the ChildTable set mapped to the column name without quoting as well, so if only the child class XML is repaired and POJOs are regenerated, then the one-to-many link from the parent class causes a runtime exception since the one-to-many link now shows mappedby="unresolved".

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