AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Hibernate in JBoss: You cannot commit during a managed trans

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java and Databases
View previous topic :: View next topic  
Author Message
Carlo LF
Guest





PostPosted: Mon Dec 20, 2004 3:07 pm    Post subject: Hibernate in JBoss: You cannot commit during a managed trans Reply with quote



Quote:
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

Back to top
Carlo Luib-Finetti
Guest





PostPosted: Mon Dec 27, 2004 12:13 pm    Post subject: Re: Hibernate in JBoss: You cannot commit during a managed t Reply with quote



Carlo LF schrieb:
Quote:
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
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§

Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java and Databases All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.