hai, ejbRemove() is called for session beans every time the container destroyes the bean. So you can use this method to do the stuff you typically would do in unsetEntityContext(). For entity beans ejbRemove() is only called if the user explicitly deletes the bean. I think that is the reason why the engineers at SUN invented the unsetEntityContext() for this kind of bean.
Hi, then can i know how to manually call unsetEntityContext? I dont want to call ejbRemove but my ejbRemove will delete the actual data in database. What i want is to manually destroy the entity object in memory. So can i call unsetEntityContext? And how to call it?
unsetEntityContext is a container callback method. So u can not explicitly call it. the container calls it when the bean instance is to be destoyed from the memory. It does not mean that the bean is deleted from database. Container only dis-associates the bean instance and destroys the instance. Correct me if i am wrong.