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

前端 未结 2 986
温柔的废话
温柔的废话 2021-01-04 08:39

When Spring catches an SQLException, does it close the prepared statement, result set, and/or connection before throwing it\'s own DataAccessException (runtime) exception?

2条回答
  •  礼貌的吻别
    2021-01-04 09:31

    I think your developer should take a look at springs transaction managemant capabilities. You can use AOP to advice logging, rollback behavior and even retry or other exception handling actions to react completly declarative.

提交回复
热议问题