[jboss-user] [EJB 3.0] - Transaction rolled back question

viniciuscarvalho do-not-reply at jboss.com
Fri Nov 16 07:26:49 EST 2007


Hello there! I have an MDB that calls a SLSB to process a message.

The SLSB perform some operations on the database. The SLSB captures all the exceptions that might happen never throwing them. But I'm getting in a sistuation where and SQLException happens, the Transaction is rolled back (even though my code captures it) and the message gets redelivered untill the threshold is reached.

Here's some sample code:

  | private void process(messageID){
  | try{
  | dao.updateMessage(messageID);
  | }catch(Exception e){
  | dao.recordError(messageID);
  | }
  | 
  | }
  | 
  | //DAO:
  | 
  | public void updateMessage(long messageID){
  | try{...}
  | catch(SQLEXception e){
  | throw new RuntimeException(e);//softening the exception
  | }
  | 

Another issue, is that the record does not persist, even though it is annotated with REQUIRESNEW transaction attribute. 

I know that the container invalidate the transaction on a RuntimeException, but I tought it had to be thrown in order to the transaction be invalidated. 

Any suggestions.
What's wrong here?
REg

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

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



More information about the jboss-user mailing list