I like the obvious simplicity of JdbcTemplate, but I'm a bit confused as to how this works. It seems that each operation (query () or update ()) retrieves the connection from the data source and closes it.
Nice, but how do you execute multiple SQL queries in the same connection?
I may need to perform several operations in a sequence (for example, SELECT, followed by INSERT, followed by a commit), or I may need to execute nested queries (SELECT, and then perform a second SELECT based on the result of each row).
How to do it with JdbcTemplate. Am I using the correct class?
source
share