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 - 20 Dec 2004 15:06 GMT
>Are you getting an instance of Hibernate through JBoss or on your
own.

I bound the Hibernate SessionFactory into JBoss JNDI as Bauer/King
adviced in their book 'Hibernate in Action', so I get a Hibernate
Session by doing a lookup for the SessionFactory.

If I understand the book from above, it says that Hibernate is smart
enough to detect if it is running in a managed environment, where
transactions are governed by a separate Transaction Manager (which,
btw, you have to configure in Hibernate's global configuration). So I
thought, that a statement which commits a Hibernate transaction,
simply does nothing, but 'waits' until the JBoss TX manager commits
the transaction.

Carlo Luib-Finetti
Carlo Luib-Finetti - 27 Dec 2004 12:13 GMT
Carlo LF schrieb:
>>Are you getting an instance of Hibernate through JBoss or on your
>
[quoted text clipped - 13 lines]
>
> Carlo Luib-Finetti
I have found the solution at
http://forum.hibernate.org/viewtopic.php?t=935847

"You're trying to commit from within a bean running in a managed
environment (ie JBoss).

You need to change the transaction strategy so enable HB integration
with JTA

In hibernate.properties, change the factory_class property

hibernate.transaction.factory_class=net.sf.hibernate.transaction.JTATransactionFactory

Look into Hibernate in Action, Chapter 2, section 2.3.3 if you need
further information§


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.