[hibernate-issues] [Hibernate-JIRA] Commented: (HBX-657) improve foreign key constraint name docs and inverse generation
Robert van Eersel (JIRA)
noreply at atlassian.com
Thu Jan 17 10:45:55 EST 2008
[ http://opensource.atlassian.com/projects/hibernate/browse/HBX-657?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_29356 ]
Robert van Eersel commented on HBX-657:
---------------------------------------
Proposed change to CfgHbmTool.java:
public String getForeignKeyName(Property property) {
if (isManyToOne(property)) {
Value value = property.getValue();
Iterator i = value.getTable().getForeignKeyIterator();
ForeignKey foreignKey = (ForeignKey) i.next();
if(i.hasNext()) {
log.warn("More than one foreign key found for property: " + property.getName());
}
if (foreignKey != null) {
return foreignKey.getName();
}
}
return "";
}
Proposed change to many-to-one.hbm.ftl:
<#assign foreignkey = c2h.getForeignKeyName(property)>
<#if foreignkey != "">
foreign-key="${foreignkey}"
</#if>
> improve foreign key constraint name docs and inverse generation
> ---------------------------------------------------------------
>
> Key: HBX-657
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-657
> Project: Hibernate Tools
> Issue Type: Improvement
> Affects Versions: 3.1.beta5
> Reporter: Max Rydahl Andersen
> Fix For: 3.2.1
>
>
> <foreign-key constraint-name/>
>
> Documentation for the constraint-name attribute has to be improved. What exactly is this? Is it something that comes from the database (I know it is)? The
> foreign key constraint name is not generated/included in the <many-to-one> column or the collection key column in the hbm.xml file. The set is
> inverse="true", even if <many-to-one> is excluded.
--
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