Optimizing dynamic SQL query
I'm looking for a SQL query builder that can optimize SQL queries based on a set of data that I want to retrieve from the database. The set of data is an array of "give me the value of column A from table B where the column C equals D". The value of A, B, C and D can be arbitrary in the array, but many records will share the same B, C and D.
What would be the best way to concatenate a query for Hibernate? Is there any reason to use another framework for queries like this?
Criteria is for you:
List cats = sess.createCriteria(Cat.class) .add( Restrictions.like("name", "Fritz%") ) .add( Restrictions.or( Restrictions.eq( "age", new Integer(0) ), Restrictions.isNull("age") ) ) .list();