[hibernate-issues] [Hibernate-JIRA] Commented: (HBX-932) reveng creates field names which are Java reserved words

Gary Plante (JIRA) noreply at atlassian.com
Wed Apr 18 05:30:04 EDT 2007


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

Gary Plante commented on HBX-932:
---------------------------------

Sorry. Re-testing shows my last comment is untrue for 3.2.0.b9 (was true for 3.1.0.beta5). 

> reveng creates field names which are Java reserved words
> --------------------------------------------------------
>
>                 Key: HBX-932
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-932
>             Project: Hibernate Tools
>          Issue Type: Bug
>          Components: reverse-engineer
>    Affects Versions: 3.2beta9
>         Environment: Hibernate 3.2; MS-SQL 2000; Eclipse 3.2.1
>            Reporter: Gary Plante
>            Priority: Minor
>
> I am using the reverse engineering tool to create POJO's from an existing database (schema). 
> Unfortunately, one of the tables names happens to be the same as a Java reserved word (i.e. Switch). The tool creates the .java code and uses the lower case 'switch' as the name of field (if the the table is referenced by another table). This causes the Java code not to compile! E.g: 
> [code] 
> // Generated 2007/04/18 09:53:07 by Hibernate Tools 3.2.0.b9
> /**
>  * ActiveEndpoint generated by hbm2java
>  */
> public class ActiveEndpoint  implements java.io.Serializable {
>      private int serviceId;
>      private Switch switch;
>     public ActiveEndpoint() {
>     }
>     public ActiveEndpoint(int serviceId, Switch switch) {
>        this.serviceId = serviceId;
>        this.switch = switch;
>     }
> ...
> // Generated 2007/04/18 09:53:07 by Hibernate Tools 3.2.0.b9
> /**
>  * Switch generated by hbm2java
>  */
> public class Switch implements java.io.Serializable {
>     private int id;
>     private String name;
> ...
> [/code] 
> Explicitly forcing the name to something else in hibernate.reveng.xml (e.g. Switch -> CTISwitch) does not help - the field name remains the same even if the class name changes.

-- 
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