using Spring JdbcTemplate for multiple database operations

Posted by Joel Carranza on Stack Overflow See other posts from Stack Overflow or by Joel Carranza
Published on 2010-04-01T22:42:21Z Indexed on 2010/04/01 22:43 UTC
Read the original article Hit count: 576

Filed under:
|
|
|

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?

© Stack Overflow or respective owner

Related posts about java

Related posts about spring