Menu

About some changes in the basecode

Help
Hamvil
2008-01-12
2013-04-25
  • Hamvil

    Hamvil - 2008-01-12

    Hi,

    I'm porting a webapp to sql2java 2.6.6 from (i think) version 2.6.3.

    I've just realized there there are many changes, for example the following doesn't work anymore:

          query = "WHERE " + CocusMemberroleManager.NAME_IDCONFERENCE + "=" + idConference +
              " AND (" + CocusMemberroleManager.NAME_ROLE + "='admin' OR " +
              CocusMemberroleManager.NAME_ROLE + "='head')";

    because NAME_IDCONFERENCE is not defined. Which is the preferred way to implement the
    previous statment?

    Thanks
    R.

     
    • Alain Fagot Béarez

      Your version of sql2java may be prior to the 2.6.3 since I don't remember of generating the NAME_ fields in the Manager class.

      I think you would need to make some change to the pertable/manager.java.vm template in order to make the FULL_FIELD_NAMES constant publicly available.  Then you would use CocusMemberroleManager.FULL_FIELD_NAMES[CocusMemberroleManager.ID_IDCONFERENCE] where you used CocusMemberroleManager.NAME_IDCONFERENCE.

      Alternatively you could modify the same template in order to generate the NAME_ fields as by:

      #foreach ( $column in $columns )
          /**
           * Name of the $column.getName() field.
           */
          public static final String NAME_$column.getConstName() = "$column.getName()";

      #end

      This may be a spare of time for your porting project.  Just keep a version controlled copy of your tuned template.

      Hope this helps,
      Alain.

       

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.