- Posted by: orjun thengdi
- Posted on: April 07 2004 11:22 EDT
I have a senario which is as follows .....
I have a Stateless Session Bean ( Bean Managed )
There is a Transaction that starts within this bean - transaction.begin()
A call is made to a CMP to insert some records
Some validations are made in the BMP, and accoriding to the outcome of the validations I need to either commit or rollback this Transaction. But when I try and rollback this transaction it fails. This is when I am using Weblogic7 SP4 with Oracle817 Drivers.
When I replace the CMP with a stored procedure, the Rollback still doesnt happen. I'm getting the connection from a TxDataSource.
Is there something that I'm missing/not doing in the DTD or the Weblogic Connection Pool setup ? ( I have tried autoCommit=false in the connection pool , but it does not work ! )
DTD ........... Given Below... (ejb-jar.xml)
<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN' 'http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd'>
- Transaction Rollback Issue using Stateless Session Bean (BMP) by Kumaraguruparan Karuppasamy on April 07 2004 18:00 EDT
- Transaction Rollback Issue using Stateless Session Bean (BMP) by orjun thengdi on April 07 2004 21:50 EDT
Check for the transaction-attribute for your CMP. Does it say "Required"?
Yes the Transaction Attribute iis set to 'Required', further even when I replace the CMP with a Stored Procedure, the Transaction Rollback dosent work!
Just want to know this,
R u using CMP Entity bean to communicate from the stateless session, isn't it?
What is the transaction attribute of the stateless session bean?
Its a Bean Managed Stateless Session Bean, hence will not have a txn State.
Further, I think I solved the problrm.... WL70 set autocommit for its Connection pool to 'true' by default. Though I do not know how to globally set the autocommit to 'false' using the WL console, I set the autocommit to 'false' in my code where I was using the Connection from the pool and this solved the problem.
setting autoComit = false in the connection pool descriptor is not enough. it is also important to check weather the table type created in the database supports transactions.
e.g MYISAM table type in mysql doesnot support transactions where INNODB table type does.
So setting auto commit = false for MYISAM has no effect as the database server sets the auto commit flag to true by default for MYISAM table type.