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

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -