We have a Java J2EE application that uses individual web service calls for each insert / update of a database row. It turned out to be too slow. They made me fix it quickly. I plan to convert all web service calls to regular JDBC. To do this, I need to get the JDBC connection from the pool, and then use it in several ways. I need to use the same JDBC connection in multiple DAOs to merge all this into a single database transaction. I can explicitly pass the JDBC connection to each DAO that it needs, but it will require me to replace the LOT method signatures, as well as a lot of unit tests (which runs counter to the "fast" part).
I'm trying to come up with a good way to connect JDBC, and then just capture it in the methods that it needs, without having to explicitly pass it everywhere. We cannot use Spring, JPA or Hibernate in this project because the support team will not support these technologies. I can connect a JDBC connection to EJB, but I'm not sure how reliable this will be. I can create a custom Singleton to manage database connections for each user (session?), But I need to be careful about thread safety. If someone tried to do something like this before, I would appreciate some advice.
source
share