Select for update spring jdbctemplate

broken image
broken image

Database purists may argue that this approach is too simple minded.

broken image

With just a single additional interceptor class, and a few lines of configuration, all the update() calls from JdbcTemplate will be transactional, thereby fixing the problem I was seeing. A reference to this proxy can then be passed into the beans wherever the JdbcTemplate reference was being passed in. Since we are proxying a class (not an interface) we need to have the CGLIB JAR in our classpath. We configure a bean to be a Proxy for JdbcTemplate.