Hi!

This and similar issues have been already addressed in newtorque by adding
javaName attribute to table and column elements.
You may use it to specify name to be used to reference the table/column in
the Java code. It will preserve the case you specify and it is also a good
idea to use this attribute to handle the differences between SQL and Java
naming conventions, such as:

VISITOR.VISITOR_ID makes a lot of sense in SQL, however in Java you are much
better having visitor.getId() instead of visitor.getVisitorId(); This can be
easily accomplished in newtorque as foloows:

<column name="VISITOR_ID" javaName="Id" ..../>

also newtorque has some other advantages over torque
so, as you could understand, I encourage you to look at newtorque.

Fedor.

PS. BTW, what do you guys think about 'officially' redirecting all feature
work from torque to newtorque?

>  I've started to play around with the torque stuff.  I noticed that
>  if I use the proper naming scheme for variables (i.e. first letter
>  lower case, upper case for the first letter of subsequent words, e.g.
>  firstName, optionGroupDateId), XMLSchemaToObjectModel.java will
>  not preserve this.
>  
>     I would like to propose, that we preserve the case that the writer of
the
>  xml file uses. (other than we don't capitalize the first letter other
than
>  for the class name itself).
>  
>     otherwise we see stuff like this:
>     public int getOptiongroupdateid()
>  
>     instead of 
>     public int getOptionGroupDateId()
>  
>  
>     Below is the patch that I use;  any chance we can get it in cvs ?
>  
>  
>  thanks !
>  
>  mike haberman
>  
>  
>  
>  --- XMLSchemaToObjectModel.java Thu Oct 26 17:29:38 2000
>  +++ XMLSchemaToObjectModel.java.bak     Thu Oct 26 17:29:24 2000
>  @@ -596,16 +596,25 @@
>       }
>   
>       /**
>  -     * Makes the first letter caps and the rest lowercase.
>  +     * Makes the first letter caps 
>        *
>        * @param data A String.
>        * @return A new String with the said processing applied.
>        */
>       private String firstLetterCaps (String data)
>       {
>  -        String firstLetter = data.substring(0, 1).toUpperCase();
>  -        String restLetters = data.substring(1).toLowerCase();
>  -        return firstLetter + restLetters;
>  +       return data.substring(0, 1).toUpperCase() + data.substring(1);
>  +    }
>  +
>  +    /**
>  +     * Makes the first letter lower case 
>  +     *
>  +     * @param data A String.
>  +     * @return A new String with the said processing applied.
>  +     */
>  +    private String firstLetterLower (String data)
>  +    {
>  +       return data.substring(0, 1).toLowerCase() + data.substring(1);
>       }
>   
>       /**
>  @@ -1075,8 +1084,9 @@
>                   String type = getJavaType(cmap.getType());
>   
>                   String realColumnName =
>  getColumnName(cmap.getColumnName());
>  -                String field =
>  -                    removeUnderScores(realColumnName).toLowerCase();
>  +                String field = removeUnderScores(realColumnName);
>  +
>  +                field = firstLetterLower(field);
>   
>                   pw.println("    /** the value for the " + field +
>                                   " field */");
>  @@ -1093,7 +1103,7 @@
>                   String realColumnName =
>  getColumnName(cmap.getColumnName());
>                   String field = removeUnderScores(realColumnName);
>                   String type = getJavaType(cmap.getType());
>  -                String fieldlower = field.toLowerCase();
>  +                String fieldlower = firstLetterLower(field);
>   
>                   // Get.
>                   pw.println("    /**");
>  
>  
>  
>  ------------------------------------------------------------
>  To subscribe:        [EMAIL PROTECTED]
>  To unsubscribe:      [EMAIL PROTECTED]
>  Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
>  Problems?:           [EMAIL PROTECTED]
>  


fedor.





_______________________________________________________
Say Bye to Slow Internet!
http://www.home.com/xinbox/signup.html



------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to