1] Because session objects do not have primary keys that are accessible to clients, invoking the javax.ejb.EJBHome.remove(Object primaryKey) method on a session results in the javax.ejb.RemoveException. (Refer to section 6.3.2 Removing a session object of EJB 2.0 specification)
2] Because session objects do not have primary keys that are accessible to clients, invoking the javax.ejb.EJBLocalHome.remove(Object primaryKey) method on a session results in the javax.ejb.RemoveException. (Refer to section 6.4.2 Removing a session object of EJB 2.0 specification)
3] If a session bean instance is participating in a transaction, it is an error for a client to invoke the remove method on the session object�s home or component interface object. The container must detect such an attempt and throw the javax.ejb.RemoveException to the client. (Refer to section 7.6.4 Restrictions for transactions of EJB 2.0 specification)
Remember, RemoveException is declared in throws clause of following methods: EJBHome: 1] remove(Handle handle) and 2] remove(Object primaryKey)
EJBLocalHome: 1] remove(Object primaryKey)
EJBObject: 1] remove()
EJBLocalObject: 1] remove()
Hope this helps. [ November 17, 2004: Message edited by: Sandesh Tathare ]
Regards,<br />Sandesh<br />(SCJCP, SCWCD, SCBCD - 99%, OCP-1)<br /> <br />Either find a way or create one.
The remove()behaves different for Stateful & Stateless session beans.
In Stateful session beans the client can get the javax.ejb.RemoveException becuase clinet calls the remove() hence ejbRemove() is called on bean here the EJBObject is directly related to Bean Instance throu out the session of client.
But if the case is Stateless Session Bean then the client is not responsible for calling ejbRemove() of the bean it will be called by container when it wants to do depending on load or other criterias, so the client will never get this type of Exception even if the client call remove() on stateless session bean. i.e. Here remove() will never call ejbRemove() on bean instance.
Joined: Jun 22, 2003
client will never get this type of Exception even if the client call remove() on stateless session bean.
Client would get RemoveException, if client calls remove(Object PK) on Stateless Session Bean. I have tried this out.