Jan 27th, 2012, 02:35 AM
StoredProcedure bug if used within JTA transaction?
I am facing (b)locking behavior in the following scenario:
1-the application starts a JTA transaction with Spring
2-the application executes a stored procedure via a Spring StoredProcedure (wired with our DataSource implementation)
3-this in turn uses the Spring JdbcTemplate and DataSourceUtils
The problem is that DataSourceUtils does not close the JDBC connection: doReleaseConnection deems it the transactional connection and keeps it open until the transaction commits.
The consequence is that any later queries via Hibernate (in the SAME transaction) will NOT see the results of the stored procedure. Even worse, later queries will block because the connection (and its locks) are still pending. This happens every time.
IMHO the DataSourceUtils should close the (pooled, XA) connection rather than keeping it open. Or am I missing something that can avoid this behavior?