[
http://opensource.atlassian.com/projects/hibernate/browse/HBX-657?page=co...
]
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira