Menu

Capitalization in table/field names

Help
2005-10-17
2013-04-25
  • Garth Patil

    Garth Patil - 2005-10-17

    I'm using sql2java with a mysql database, and I was wondering if there is a way to maintain my table and field capitalization scheme in the generated classes. For example, if I have a table:
    CREATE TABLE `sportsGame` (
      `gameId` int(10) unsigned NOT NULL auto_increment,
      `awayScore` smallint(5) unsigned NOT NULL default '0',
      `homeScore` smallint(5) unsigned NOT NULL default '0',
      PRIMARY KEY  (`gameId`)
    );

    I run generate on that table, the class names come out as SportsgameBean, SportsgameManager, etc., and the field names are gameid, awayscore, homescore. I'd really like to maintain the capitalization I used in the schema and have class names SportsGameBean, SportsGameManager, etc., and field names gameId, awayScore, homeScore. Is there a way to specify that in the configuration, or by modifying the templates?
    Thanks!

     
    • Garth Patil

      Garth Patil - 2005-10-17

      For the problem I outlined above, I just made a change to the StringUtilities.convertName(String, boolean) static method that helped conform the table and field names to our preferred style in java. The quick way to do it is by just removing the toLowerCase() before it is converted to a char array.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.