It looks like overriding JdbcTemplate might do the trick for me. I noticed that all JdbcTemplate operations call one of the following:
Code:
execute CallableStatementCreator, CallableStatementCallback)
execute(ConnectionCallback)
execute(PreparedStatementCreator, PreparedStatementCallback)
execute(StatementCallback)
Each of them create a connection and execute the statments created.
Either create a custom class which wraps each of these operations in a try/catch logic and reexecute the command when certain exceptions are thrown, or use Spring AOP to inject the proper code into the existing JdbcTemplate class.
What do people think?