The project I'm working on uses direct access to JDBC data in all its glory and does not use any transactions. I feel that using transactions and simplifying ways to write data access methods is important, especially with some of the changes that are currently being made. The project has existed for a long time and is not suitable for the ORM structure. He also uses a lot of singletones (pah) and unravels it to make him use dependency injection would be enough work, and I don't think I can convince anyone that we should do it now.
I like the Spring JDBC interface, in particular through it SimpleJdbcTemplate. My question is how to enable some simple (for each servlet request) transactions for this, without setting anything programmatically in any data access method, or when using the IOC Spring container or AOP. I played with my own architecture, which ends with an interface similar SimpleJdbcTemplate, and can use a single-local connection and a request transaction when calls to it are made in the context of the request (via ServletRequestListenerwith a ThreadLocal). This seems to work well, but I think that using a good external library like Spring JDBC would be preferable.
Does anyone have any experience?
source
share