1 Reply Latest reply on Nov 5, 2001 9:31 AM by Luigi Viggiano

    RemoveException on ejbRemove

    Luigi Viggiano Newbie

      this is my method:

      public void ejbRemove() throws RemoveException {
      if ("CLOSED".equals(state))
      throw new RemoveException("Impossible to remove a closed activity : " + getCode());
      }

      The container catches this exception and removes the object anyway...
      I had to replace the RemoveException in a RemoteException to disable deletion.

      But why ?
      Raising RemoveException shouldn't the remove to be stopped?

      Thanks
      Luigi.

        • 1. Re: RemoveException on ejbRemove
          Luigi Viggiano Newbie

          This is what I found on EJB 1.1 specs:

          9.1.9.5 RemoveException
          From the client’s perspective, a RemoveException (or a subclass of RemoveException) indicates
          that an application level error occurred during a remove(...) operation. If a client receives this
          exception, the client does not know, in general, whether the entity object was removed or not. The client
          also does not know if the transaction has been marked for rollback. (However, the client may determine
          the transaction status using the UserTransaction interface.)
          The Bean Provider throws the RemoveException (or subclass of RemoveException) from the
          ejbRemove() method to indicate an application-level error from the entity object removal operation.
          Optionally, the Bean Provider may mark the transaction for rollback before throwing this exception.
          The Bean Provider is encouraged to mark the transaction for rollback only if data integrity would be
          lost if the transaction were committed by the client. Typically, when a RemoteException is thrown, it
          leaves the database in a consistent state, allowing the client to recover.
          The Container treats the RemoveException as any other application exception. See Section 12.3.


          Also another question now: How can I mark the transaction for rollback ?