Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / December 2004

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Carlo LF - 17 Dec 2004 18:07 GMT
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 - 17 Dec 2004 19:53 GMT
Are you getting an instance of Hibernate through JBoss or on your own.

> Hi everybody,
>
[quoted text clipped - 22 lines]
>
> Carlo Luib-Finetti


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.