using Spring JdbcTemplate for multiple database operations
- by Joel Carranza
I like the apparent simplicity of JdbcTemplate but am a little confused as to how it works. It appears that each operation (query() or update()) fetches a connection from a datasource and closes it.
Beautiful, but how do you perform multiple SQL queries within the same connection?
I might want to perform multiple operations in sequence (for example SELECT followed by an INSERT followed by a commit) or I might want to perform nested queries (SELECT and then perform a second SELECT based on result of each row).
How do I do that with JdbcTemplate. Am I using the right class?