2 Replies Latest reply on Dec 13, 2005 3:40 AM by Jacek Olszak

    One more question about transactions

    Jacek Olszak Newbie

      Last few days I was thinking about transactions which can be manipulated by the client. But till now I've no good solution. I want to have a bean which transactions can be started, rollback and commit by the client. I want to have a solution, where client can rollback only last transaction (not everything).

      I've created simple stateful bean:

      public class TransactionsStateful implements TransactionsStatefulLocal {
       @PersistenceContext(unitName = "ksiegi", type = PersistenceContextType.TRANSACTION)
       protected EntityManager em;
       protected SessionContext ctx;
       public void commit() {
       public void rollback() {
       throw new RamzesException("Rollback");
       private short tmpId = 0;
       public void a() {
       TypDzial typ = new TypDzial();
       tmpId = typ.getId();

      I run this code using:

      try {
      } catch (RamzesException e) {

      But the data was stored, even though I've thrown an exception using rollback method :( Yes, I know that I've catched the exception but client will be executing methods this way - he can rollback only last transaction, not all.

      Is there any chance to rollback only last transaction?