2 Replies Latest reply on Feb 25, 2008 8:55 AM by 1 1

    requiresnew

    1 1 Newbie

      I have a 2 methods on a session bean:
      1. void sendEmail(SomeEmailBean) # marked as REQUIRED
      2. void saveFailedEmailToDatabase(SomeEmailBean) # REQUIRESNEW

      I want the first method to call the second internally when the email fails (ex: SMTP server down). So I have:
      try { // code to send email
      }
      catch (Exception e) {
      // lookup remote interface to EmailServiceBean (using remote on purpose to try to force the REQUIRESNEW)
      // call saveFailedEmailToDatabase method on the remote interface
      // throw a runtime exception at this point in case we are part of a larger transaction so it will rollback
      }

      .. now I have debug code in the saveFailedEmailToDatabase method, so I see it getting called from the catch block and I see it trying to write data to the database (I use db generated sequence #s and I see those getting populated after the db calls). *But* when I actually look at the database the table is empty (which makes it look like the call on the remote interface is getting tied to the current transaction so it is rolling back). Has anyone seen anything like this? FYI: I'm on JBoss 4.2.1.