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:
I have seen one product called JStorm which tries to emulate this functionality but I am looking for a more full featured suite.