Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8853667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:42:31+00:00 2026-06-14T13:42:31+00:00

For our web application, all DB access is performed via stored procedures. This design

  • 0

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:

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.

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.


@ctapobep – this is how it is done using plain JDBC.

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;


public class PlainJdbcTest
{
    private static final String USERNAME = "sa";
    private static final String PASSWORD = "password";
    private static final String URL = "jdbc:jtds:sqlserver://myserver:1433;DatabaseName=testDatabase;prepareSQL=0";
    private static final String QUERY = " EXEC dbo.SP_ProductSearch ?";
    private static final String DRIVER = "net.sourceforge.jtds.jdbc.Driver";


    public static void main(String[] args) throws Exception
    {
        Class.forName(DRIVER).newInstance();

        final Connection connection = DriverManager.getConnection(URL, USERNAME, PASSWORD);
        final PreparedStatement statement = connection.prepareStatement(QUERY);
        statement.setString(1, "ba");
        final ResultSet resultSet = statement.executeQuery();

        while(resultSet.next())
        {
            final int id = resultSet.getInt(1);
            final String desc = resultSet.getString(2);
            System.out.print(id + " / " + desc);
        }

        if(resultSet != null) resultSet.close();
        if(statement != null) statement.close();
        if(connection != null) connection.close();
    }
}

And this is what is shown in the profile – so works perfectly!

EXEC dbo.SP_ProductSearch  N'ba'
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T13:42:32+00:00Added an answer on June 14, 2026 at 1:42 pm

    I haven’t discovered any way to prevent Hibernate from using transactions, so as a work-around I’ve switched to MyBatis which works perfectly.

    http://www.mybatis.org/spring/index.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Our legacy web application heavily uses stored procedures. We have a central interface through
For our web application, we are sending the X-UA-Compatible -> IE=EmulateIE7 for all the
As part of our web application's build process, I have set up our XSLT
Problem: Our web console shows a list of all computers on which our application
We allow users to set some preferences in our web application. When they login
Part of my project wrote all their code in C#. Our web application is
We're using NLog for logging in an C# MVC3 web application. All of our
All of our applications have Debug=False in the web.config and Release DLL's. We have
Our Web application is based on IE9, which means only IE9 can open the
In our web application, we have multiple small applications availables. Let us say A,B,C.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.