[
http://opensource.atlassian.com/projects/hibernate/browse/HBX-856?page=all ]
Derek Price updated HBX-856:
----------------------------
Attachment: test.sql
hibernate.reveng.xml
I cut away everything except two of the offending tables (I have at least 3 pairs of
tables exhibiting this problem) and most of their fields and can still duplicate the
problem. I've attached the SQL script to duplicate the offending schema and the
extremely minimal reveng.xml I've been using.
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
Attachments: hibernate.reveng.xml, test.sql
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira