I'm using JBoss 4.0.1 with MySQL 4.1.8. I also checked to make sure all my 
tables were InnoDB.

For some reason or another, the following code does not rollback changes made 
to the myEJB entity bean:


  | /**
  |  * @ejb.interface-method view-type = "both"
  |  * @ejb.transaction type = "Required"
  |  */
  | public void completeRequest(MyDTO dto) throws MyException {
  |    myEJB.setApprovedBy(approvedBy);
  |    myEJB.setApprovedAmount(amount);
  |    myEJB.setDateApproved(currentTime);
  |    myEJB.setStatus(REQUEST_COMPLETED);
  |    myEJB.setComments(dto.getComments());
  | 
  |    try {
  |              ....(call to another session facade)
  |          
  |            } catch (MyException e) {
  |                context.setRollbackOnly();
  |    
  |                throw e;
  |            }
  |    }
  | }
  | 

However, If I execute the following SQL against the same table the bean 
represents the trasnsaction rollback works fine:


  | BEGIN;
  | INSERT INTO myTable(subject)
  | VALUES ('test');
  | ROLLBACK;
  | 

I also got the TRACE output from JBoss when my sessionbean throws MyException:

  | 16:14:03,015 DEBUG [MyEJB#findRequestsByStatus] Executing SQL: SELECT 
t0_o.requestID FROM myTable t0_o WHERE (t0_o.status = ?)
  | 16:14:03,015 DEBUG [MyEJB#findRequestsByStatusAndType] Executing SQL: 
SELECT t0_o.requestID FROM myTable t0_o WHERE (t0_o.status = ? AND t0_o.type = 
?)
  | 16:14:31,656 DEBUG [FinanceRequestBean] Executing SQL: UPDATE myTable SET 
comments=?, status=? WHERE requestID=?
  | 

Any ideas on how to solve this? Thanks for your time.

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

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


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to