Non GUI JDBC SQL Query Builder Class


EJB programming & troubleshooting: Non GUI JDBC SQL Query Builder Class

  1. Non GUI JDBC SQL Query Builder Class (2 messages)

    Hi Everyone,

    Okay, the discussion about CMB/JDO/JDBC aside, lets assume that for reasons I won't go into, JDBC has won the day.

    I want to build up a query for a JDBC statement in various parts of a system and then extract the string query for execution. I really dislike modifying a string with concatenations and believe there should be a support class which supports building an SQL query objectively.

    Some sample operations may be:
    void SQLQuery.addConstraint(Constraint c)
    void SQLQuery.addJoin(Table t, Constraint c)
    void SQLQuery.addJoin(Table t, JoinTable t2, JoinField f)

    This way, a query could be passed between various parts of the system, where it could then be interrogated and augmented in a standard way. Finally, when it was time to execute the JDBC query, the following method could be used:

    boolean SQLQuery.parseSyntax()
    String SQLQuery.getQuery()

    I have seen one product called JStorm which tries to emulate this functionality but I am looking for a more full featured suite.


    David Levy

    Threaded Messages (2)

  2. Non GUI JDBC SQL Query Builder Class[ Go to top ]
  3. Thanks[ Go to top ]

    Thanks for that, exactly what I'm after.