Hi All,
For our web application, all DB access is performed via stored procedures. This design decision is set in stone and there is no way I can change it.
Additionally, all transaction handling is done within the stored procedures. The Java layer must not use transactions.
I can easily accomplish this using plain JDBC. But I’d prefer to use Hibernate for its ORM and caching features.
Calling stored procedures with Hibernate is easy:
Code:
final Session session = sessionFactory.getCurrentSession();
final Query query = session.createSQLQuery("EXEC dbo.SP_ProductSearch :searchStr").addEntity(Product.class).setString("searchStr", "ap");
return query.list();
But when I run a DB profile, I see the following.
Code:
SET IMPLICIT_TRANSACTIONS ON
EXEC dbo.SP_ProductSearch N'ap'
IF @@TRANCOUNT > 0 COMMIT TRAN
IF @@TRANCOUNT > 0 COMMIT TRAN
SET IMPLICIT_TRANSACTIONS OFF
Is there anyway I can disable the 4x transaction statements?
My technology stack is as follows.
Spring 3.1.2
Hibernate 4.1.8
jTDS (JDBC driver) 1.2.5
MS SQL Server 10.x
Many thanks in advance... Adam.