-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: You cannot set autocommit during a mamanaged transaction
PostPosted: Wed Aug 24, 2005 6:42 pm 
Beginner
Beginner

Joined: Thu Jun 30, 2005 4:14 pm
Posts: 25
I have a couple of questions.

My application consists of some servlets and EJB session bean.
The goal is to save the data objects with hibernate.
I uses Jboss 4.0.2 and hibernate3

After loading the servlet, there are the exceptions:
-----------------
16:16:51,213 INFO [STDOUT] java.sql.SQLException: You cannot set autocommit during a managed transaction!
16:16:51,213 INFO [STDOUT] at org.jboss.resource.adapter.jdbc.BaseWrapperMa
nagedConnection.setJdbcAutoCommit(BaseWrapperManagedConnection.java:462)
16:16:51,213 INFO [STDOUT] at org.jboss.resource.adapter.jdbc.WrappedConnec
tion.setAutoCommit(WrappedConnection.java:432)
------------------------


I think the reason is servlet and EJB is configured in non-managed and managed environments.
I read the book Hibernate in Action. Since Hibernate needs to be portable across these environments (page 49-50). Using JTATransactionFactory may fix this problem. I set up hibernate-service.xml, but running in jboss,

No Attribute found with name: TransactionStrategy.
-------------------------------------------
16:31:33,551 INFO [ServiceConfigurator] Problem configuring service jboss.har:s
ervice=Hibernate
org.jboss.deployment.DeploymentException: No Attribute found with name: TransactionStrategy
at org.jboss.system.ServiceConfigurator.configure(ServiceConfigurator.ja
va:263)
at org.jboss.system.ServiceConfigurator.internalInstall(ServiceConfigura
tor.java:164)
at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java
:118)
at org.jboss.system.ServiceController.install(ServiceController.java:202
)
-------------------------------------------
Where is wrong? Or if this is a right way to fix “You cannot set autocommit during a managed transaction!” issue?

Thank you for your help!

chwang

This is hibernate-service file:


<server>
<mbean code="org.jboss.hibernate.jmx.Hibernate"
name="jboss.har:service=Hibernate">
<attribute name="DatasourceName">java:/PDSSTUDIO_DS</attribute>
<attribute name="Dialect">org.hibernate.dialect.SQLServerDialect</attribute>
<attribute name="SessionFactoryName">java:/pdsstudio/SessionFactory</attribute>
<attribute name="TransactionStrategy">
org.hibernate.transaction.JTATransactionFactory</attribute>

</mbean>
</server>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


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

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.