troubleshooting Question

Hibernate: JDBCTransaction toggleAutoCommit Could not toggle autocommit

Avatar of jaggernat
jaggernat asked on
Java
16 Comments1 Solution16188 ViewsLast Modified:
hi guys

when i use this code



                Session session = HibernateUtil.getSessionFactory().getCurrentSession();      
            session.beginTransaction();
            try {

                //code to call store proc

                }
            catch(Exception e)
                {
            e.printStackTrace();
                }


            session.getTransaction().commit();


i get this exception

>>>>>>>>>>>>>>>> 
org.hibernate.transaction.JDBCTransaction toggleAutoCommit Could not toggle autocommit
                  java.sql.SQLException: DSRA9350E: Operation setAutoCommit is not allowed during a global transaction.
      at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.setAutoCommit(WSJdbcConnection.java:2414)
      at org.hibernate.transaction.JDBCTransaction.toggleAutoCommit(JDBCTransaction.java:194)
      at org.hibernate.transaction.JDBCTransaction.commitAndResetAutoCommit(JDBCTransaction.java:142)
      at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:115)
      at com.aoc.judiciary.framework.daoImpl.TestDaoImpl.getInfo(TestDaoImpl.java:69)
      at com.aoc.judiciary.framework.ejb.BeantestingBean.retrieveInfo(BeantestingBean.java:95)
      at com.aoc.judiciary.framework.ejb.EJSLocalStatelessBeantesting_f63227a0.retrieveInfo(EJSLocalStatelessBeantesting_f63227a0.java:29)
      at com.aoc.judiciary.framework.delegateImpl.LocalTestDelegateImpl.retrieveInfo(LocalTestDelegateImpl.java:74)
      at com.aoc.judiciary.framework.ActionClasses.Action1.retrieve(Action1.java:76)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
and intrestingly when i dont write the  "session.getTransaction().commit() "  statement , there are no exceptions on console.

any one encountered this situation in their project?

thanks
J
ASKER CERTIFIED SOLUTION
NHBFighter

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 16 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 16 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros