Menu

Differences in how where clauses are handled

Help
Greg Smith
2004-06-09
2004-06-09
  • Greg Smith

    Greg Smith - 2004-06-09

    I've churned out 36,000 lines of code using sql2java so far and been very happy with it.  There are two minor things that bug me that I wanted to point out.

    First, the syntax for the various Where methods isn't consistant:  some of them require that you include 'where' in the statement you pass, some don't.  Examples:

    m.deleteWhere("id='1'");
    m.loadByWhere("where id='1'");

    These really should be orthogonal; right now I have to check the source every time I write any sort of where statement to make sure I'm getting what I expect.  I would recommend always requiring that the user include the "where" in the string they pass, because that makes it explicit how the text is going into the SQL query and makes it possible to do things other than just where statements there.  For example, I do this at one point:

    xBean x[]= m.loadByWhere("order by trans_date");

    and if the where were already in the SQL query I couldn't slip that in as easily.

    Second little detail:  both the Bean and the Manager classes that are generated import java.util, then don't use any functions from it.  There are also TODO tags for "BATCH UPDATE" in the generated code.  Those of us who pull in the generated code with Eclipse get all of those showing up on our autogenerated Tasks lists.  As a result, I have 30 tasks sitting around that I can't really correct, making it more difficult for me to navigate.  I would recommend that you remove the unused import and don't allow any TODO tags in the generated code itself.

     
    • nr

      nr - 2004-06-09

      Hello,

      Thanks for these feedbacks.
      I agree it is inconsistent.
      All the above will be fixed in sql2java 2.5
      Note that for consistency, deleteWhere will be renamed to deleteByWhere. It will also force people upgrading to review their 'where' parameter string.

      N.

       

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.