[hibernate-issues] [Hibernate-JIRA] Created: (HBX-872) Pojo generation can lead to invalid property name.
Alban Soupper (JIRA)
noreply at atlassian.com
Tue Feb 13 12:00:40 EST 2007
Pojo generation can lead to invalid property name.
--------------------------------------------------
Key: HBX-872
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-872
Project: Hibernate Tools
Type: Bug
Components: reverse-engineer
Versions: 3.2beta8
Environment: Eclipse 3.2.1, JBoss IDE 2.0 beta
Reporter: Alban Soupper
The generation of the property name for a "foreignKeyToCollectionName" is not check against java reserved keywords.
eg: my table is "THI" (for Third) and the resulting property is "this"! (I know... I'm a looser ;)
Solution? :
the method "foreignKeyToCollectionName" in DefaultReverseEngineeringStrategy should be changed to
public String foreignKeyToCollectionName(String keyname, TableIdentifier fromTable, List fromColumns, TableIdentifier referencedTable, List referencedColumns, boolean uniqueReference)
{
String propertyName = Introspector.decapitalize(StringHelper.unqualify(tableToClassName(fromTable)));
propertyName = pluralize(propertyName);
if(!uniqueReference)
if(fromColumns != null && fromColumns.size() == 1)
{
String columnName = ((Column)fromColumns.get(0)).getName();
propertyName = propertyName + "For" + toUpperCamelCase(columnName);
} else
{
propertyName = propertyName + "For" + toUpperCamelCase(keyname);
}
return keywordCheck(propertyName);
-----------------------------------------
}
--
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