When doing a JDiscuss exam. I found apparently two conflicting statements, regarding an entity bean. Statement one: "When the container calls ejbRemove(), the bean enters the 'Pooled' state and is not necessarily destroyed (via unsetEntityContext() )" Statement two: "Once the bean is removed, the bean 'does not exist'" I am fairly confident that it is Statement two that is correct. Any support ?.
Thanks to your overwhelming help with this one. I must not of mentioned those magic words "Head First EJB", which appears to attract lots of help In the end I found what i was after in the specs (page 172) and found that statement one was actually correct after all. Quote from specs : "The container invokes the ejbRemove() method on an entity bean instance in response to a client-invoked remove operation on the entity bean�s home or component interface or as the result of a cascade-delete operation. The instance is in the ready state when ejbRemove() is invoked and it will be entered into the pool when the method completes."
One of those subtle times when the distinction between 'bean instance' and 'entity' matters. Calling remove() (and hence ejbRemove()) removes the real-world entity and frees up the bean instance. The bean instance doesn't have to be garbage collected, it can either be re-used to service requests for some other entity, or it can be used to service home interface business methods.
Reid - SCJP2 (April 2002)
30 seconds to difuse a loaf of bread ... here, use this tiny ad: