[hibernate-issues] [Hibernate-JIRA] Commented: (HBX-872) Pojo generation can lead to invalid property name.
    Alban Soupper (JIRA) 
    noreply at atlassian.com
       
    Fri Feb 16 03:31:42 EST 2007
    
    
  
    [ http://opensource.atlassian.com/projects/hibernate/browse/HBX-872?page=comments#action_26130 ] 
Alban Soupper commented on HBX-872:
-----------------------------------
In my case, the problem is solved in the 3.2beta9 which does not use anymore the table name to produce the property name.
> 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
>
> Original Estimate: 15 minutes
>         Remaining: 15 minutes
>
> 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