2 Replies Latest reply on Nov 21, 2001 8:08 AM by geoff webb

    Nested transaction problem - stateless session bean ??

    geoff webb Newbie

      Hi, I'm using: JBoss 2.4.3, RedHat 6.2, PostgreSQL 7.1

      I'm curious about some behaviour I am seeing in a Statless Session bean I have written. Essentially, I have two methods, one which manipulates some entity beans (Method A) and one which wraps the call to method A (method B). So the outside world calls method B which then internally calls method A to do the work of updating Entity Beans. I have set the SessionBean to have RequiresNew transactions for all methods.

      The problem is, when calling method B from some client code and getting it to update the EntityBean with invalid data (via method A), the data is only persisting (and thereby throwing an exception) when method B finishes NOT when method A finishes which is NOT what I would expect and what I want! I need to be able to see if the EntityBean update will work within the SessionBean so I can inform the client appropriately, and hopefully roll back any previous transactions within method B! At the moment, the client just sees a RemoteException from the ContainerManager which seems to occur after method B finishes.

      Is my understanding of RequiresNew correct? For all method calls, a new transaction is started and according to the JBoss manual, all commits occur at the end of a transaction.

      Any help/advice would be appreciated.

      Geoff Webb