 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Carlo LF Guest
|
Posted: Mon Dec 20, 2004 3:07 pm Post subject: Hibernate in JBoss: You cannot commit during a managed trans |
|
|
| 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
|
Posted: Mon Dec 27, 2004 12:13 pm Post subject: Re: Hibernate in JBoss: You cannot commit during a managed t |
|
|
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 |
|
 |
|
|
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
|
|