java - Does Spring's JdbcTemplate close the connection if an exception is thrown? -


when spring catches sqlexception, close prepared statement, result set, and/or connection before throwing it's own dataaccessexception (runtime) exception?

i have developer wants create aop aspect catch these exceptions , log and/or close connection.

@afterthrowing(pointcut="dataaccessoperation()", throwing="exception") public void dorecoveryactions(joinpoint thisjoinpoint, dataaccessexception exception) {      // log and/or close connection } 

yes.

that's whole point of jdbctemplate - handles kinds of boilerplate actions including release of resources. see 12. data access jdbc.


Comments

Popular posts from this blog

mod rewrite - Doing external redirect. .htaccess NS flag not working. How to achieve similar results? -

mysql - How to insert just year and month into date field? -