Multiple Statements in single Connection support
I have started looking through Spring about a month ago. The JDBC support is excellent, the IoC container amazingly useful ...
I have one question that strikes me when I started usin the JDBC packages. I have DAO objects that respond to a single method call by running multiple queries and maybe writing some updates based on the combination of the query results and the parameters passed. All this should run in a single Connection for efficiency (closing a Connection sends the PoolableConnection back to the pool to be obtained for the next query/update). Yet I would have to write a custom ConnectionCallback for this. I want to use all the nice interfaces like ResultSetExtractor and its implementations.
Wouldn't it be a good idea to write some more methods on the JdbcTemplate for this. Something like
public Object subQuery(Connection conn, String sql, ResultSetExtractor);
Not hard to do and it would make it a bit more efficient for this sort of query.
Is there a reason that I'm missing for why this is not there?