Hibernate in JBoss: You cannot commit during a managed transaction!

From: Carlo LF (carlo.lf_at_onlinehome.de)
Date: 12/17/04

  • Next message: kjc: "Re: Hibernate in JBoss: You cannot commit during a managed transaction!"
    Date: 17 Dec 2004 10:09:07 -0800
    
    

    Hi everybody,

    in simple Session Bean running in JBoss I tested Hibernate with
    MySql-Database. According to the usual I did something like this:

    Session l_sess = null;
            Transaction l_tx = null;
            try {
                l_sess = HibernateUtil.getInstance().getSession();
                l_tx =l_sess.beginTransaction();
                l_list = getAllAuctionInfos(l_sess);
                
                l_tx.commit();

    this last statement causes an exception to be thrown :
    java.sql.SQLException: You cannot commit during a managed transaction!
            at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.jdbcCommit(BaseWrapperManagedConnection.java:525)
            at org.jboss.resource.adapter.jdbc.WrappedConnection.commit(WrappedConnection.java:473)
            at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:63)
            at org.hibernate.auction.ejb.HibernateAuctionBean.viewAllAsAuctionInfo(HibernateAuctionBean.java:110)

    Why is this thrown? I thought Hibernate would synchronize with the
    container transaction.
    Any ideas?

    Carlo Luib-Finetti


  • Next message: kjc: "Re: Hibernate in JBoss: You cannot commit during a managed transaction!"