2 Replies Latest reply on Jul 17, 2002 4:43 AM by Frank Adcock

    Transaction problem in CMP ??

    Eric Chow Newbie

      Hello,

      In a SessionBean, I want to update different EntityBean(CMP), but if there is an operation failed during the updating value(setXXXX), how can I rollback all the modification ?

      Best regards,
      Eric

        • 1. Re: Transaction problem in CMP ??
          Joel Vogt Master

          Well, you can configure methods in your ejb-jar.xml to be transaction required and throw EJBExceptions (EJBException, RemoteExceptions etc..) to get a rollback,

          OR

          do a
          setSessionContext().setRollbackOnly();

          If you only want to be control it directly

          • 2. Re: Transaction problem in CMP ??
            Frank Adcock Newbie

            In your ejb-jar.xml set <trans-attribute>Required</trans-attribute> within the assembly descriptor for each of the entity bean business logic methods that are to be accessed from the SessionBean.

            Also do the same for the method that instigates all of this in the SessionBean, or set it to RequiresNew if that is more appropriate for your needs.