I really want to say thank you first. Let me make the context more clearly.

My high level architectural flow :
Stateless session bean -> Hibernate -> mysql data source ->database.

I congfigured datasource in JBoss, and use the datasource in hibernate to connect to 
MySQL.

IÂve a stateless session bean to handle my data layer operations. Once when IÂve the 
local-tx-datasource and when I do 
Session session = HibernateSessionFactory.openSession();
...
tx = session.beginTransaction(); 
...
tx.commit(); 

This is style for JDBCTransaction(BMT), so i changed my hibernate.cfg.xml, replace 
<property 
name="transaction.factory_class">net.sf.hibernate.transaction.JTATransactionFactory</property>
 with <property 
name="transaction.factory_class">net.sf.hibernate.transaction.JDBCTransactionFactory</property>,
 it is ok when i start JBoss, but when use call the bean to do some database opertion, 
the JBoss will print out 
exceptions 15:13:21,695 ERROR [JDBCTransaction] Commit failed
  | java.sql.SQLException: You cannot commit during a managed transaction!
  |     at 
org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.jdbcCommit(BaseWrapperManagedConnection.java:400)
  |     at 
org.jboss.resource.adapter.jdbc.WrappedConnection.commit(WrappedConnection.java:477)
  |     at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:63)
  | ....
The situation is the hibernate connect to database through datasource which is 
configured in JBoss, whether I can use JDBCTransaction 
as above? If I can use JDBCTransaction in this situation, what may cause the "Commit 
failed" error, and what may be the possible solution.
If not, must I use CMT, and let container to manager the transaction?

I am newbie to both JBoss and Hibernate, I may be not clear with some conceptions 
related.  Thanks!

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3830756#3830756

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3830756


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to