Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

142 views
Skip to first unread message

Carlo LF

unread,
Dec 17, 2004, 1:09:07 PM12/17/04
to
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

kjc

unread,
Dec 17, 2004, 2:54:19 PM12/17/04
to
Are you getting an instance of Hibernate through JBoss or on your own.
0 new messages