2 Replies Latest reply on May 29, 2006 3:41 AM by Sajid Moinuddin

    Client Controlled Transactions

    Markus Brigl Newbie

      Hi,

      does anyone know how can I controll transactions on the client. I wrote a small client getting an UserTransaction:

      MyStatefulSession ejb = (MyStatefulSession) ctx.lookup("..
      UserTransaction tx = (UserTransaction) ctx.lookup(...

      tx.begin();
      ejb.method1("someString");
      tx.rollback();


      The stateful session bean has declared an EntityManager with @PersistenceContext(type = PersistenceContextType.EXTENDED)

      if I invoke the method1(String) the objects created inside are stored all on the DB, even if the UserTransaction outside is rollbacked. Only if the method1 is declared @PersistenceContext(type = @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) the transaction is rollbacked correctly.

      Is this the expected behavior? Should the methods be declared always to NOT_SUPPORTED on Application Transactions?