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

Max Rydahl Andersen (JIRA) noreply at atlassian.com
Wed Jul 11 12:07:52 EDT 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/HBX-959?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_27448 ] 

Max Rydahl Andersen commented on HBX-959:
-----------------------------------------

please prove that with a testcase.

if catalog, schema and table name matches then it won't be overwritten.

What I would consider though is that if you don't specify a name the tool should try and locate a matching foreign key column/table combo.

> 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
>   Original Estimate: 1 day
>  Remaining Estimate: 1 day
>
> 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