[hibernate-issues] [Hibernate-JIRA] Created: (HBX-959) allow foreign key property name override

Dan Allen (JIRA) noreply at atlassian.com
Wed Jul 11 00:44:52 EDT 2007


allow foreign key property name override
----------------------------------------

                 Key: HBX-959
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-959
             Project: Hibernate Tools
          Issue Type: Improvement
          Components: hbm2java
    Affects Versions: 3.2beta9, 3.2beta10
            Reporter: Dan Allen
            Priority: Minor


Without any special settings, the hbm2java tool will assign the @ManyToOne property the same name as the target class. For instance, let's say you have an employee table. Each employee can have a manager, who is also an employee. The column name might be manager_id, but the hbm2java tool will name the property employee. In this case, it is desirable to override the name of the property to be manager instead of employee.  Currently, there is no way to do this if foreign keys are active on the table. It IS possible if foreign keys are NOT defined on the table since then the foreign-key element in *.reveng.xml comes into play. The problem comes when you try to override the foreign-key, it just ends up created TWO @ManyToOne properties.

What I am looking for (in hypothetical) is:

<column name="manager_id" property="manager" />

Obviously, that syntax only works for basic types, not associations. There needs to be way to override the foreign-key settings WITHOUT creating a new foreign key relationship. The location in the code where the property name is decided is JDBCBinder#bindOutgoingForeignKeys() which then delegates to ReverseEngineeringStrategy#revengStrategy.foreignKeyToEntityName()

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