We're trying to integrate some Spring managed code which uses declarative transactions and Hibernate into some legacy code which manages its own database connections and begins/commits transactions on said database connections. Is there any way to integrate the two so that the transactions can cross the boundaries between the legacy JDBC usage and the spring components? I.E.
MyTrans trans;
try {
//my legacy JDBC code
//calls to Spring managed components which do Hibernate stuff
trans.commit(); // Commit both the JDBC trans and the Spring trans
} catch (Exception e) {
trans.rollback();
}
Could we, for example, pass the database connection to the Spring Managed Hibernate SessionFactory, implement a custom transaction strategy which simply flushes the Hibernate Session configured in Spring, and then commit the trans on the JDBC connection on the legacy side of the code?


Reply With Quote