Marco Tedone<br />SCJP1.4,SCJP5,SCBCD,SCWCD
Originally posted by Marco Tedone:
Given the following question:
HF teaches us that when an entity is removed, the entity bean dies, but the entity bean instance is moved back to the pool. Doesn't this mean that after ejbRemove() the container might invoke ejbPassivate to move the bean instance back to the pool?
Eventually, the container will transition the instance to the pooled state. There are three possible
transitions from the ready to the pooled state: through the ejbPassivate() method,
through the ejbRemove() method, and because of a transaction rollback for ejbCreate(),
ejbPostCreate(), or ejbRemove() (not shown in Figure 23). The container
invokes the ejbPassivate() method when the container wants to disassociate the
instance from the entity object identity without removing the entity object. The container
invokes the ejbRemove() method when the container is removing the entity object (i.e.,
when the client invoked the remove() method on the entity object�s component interface or a
remove() method on the entity bean�s home interface).
Originally posted by Valentin Crettaz:
First of all, the statement doesn't even mention that the question is about entity beans. The fact that all options are methods in the EntityBean interface doesn't mean anything... Moreover, it is not clear at all what "when invoking ejbRemove()" means. Is it just before or just after the invocation... This question needs serious rework in my opinion.
Originally posted by Valentin Crettaz:
Well, let's assume we are talking about entity beans and that the question asks which methods can be invoked after ejbRemove(). If you have a quick look at my bean lifecycle cheatsheet (page 1), you'll see that after ejbRemove() the container can invoke ejbFind<METHOD>(), ejbSelect<METHOD>(), ejbActivate(), ejbPostCreate<METHOD>(), ejbHome<METHOD>() and unsetEntityContext(). From the available options, only D is correct. A is wrong since the method name does not include some arbitrary suffix (aka <METHOD> .
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.
SCJP 1.4 / 5.0 - SCBCD 1.3 - SCWCD 1.4 - IBM 484
Originally posted by Valentin Crettaz:
First of all, the statement doesn't even mention that the question is about entity beans. The fact that all options are methods in the EntityBean interface doesn't mean anything... Moreover, it is not clear at all what "when invoking ejbRemove()" means. Is it just before or just after the invocation... This question needs serious rework in my opinion.
Well, let's assume we are talking about entity beans and that the question asks which methods can be invoked after ejbRemove(). If you have a quick look at my bean lifecycle cheatsheet (page 1), you'll see that after ejbRemove() the container can invoke ejbFind<METHOD>(), ejbSelect<METHOD>(), ejbActivate(), ejbPostCreate<METHOD>(), ejbHome<METHOD>() and unsetEntityContext(). From the available options, only D is correct. A is wrong since the method name does not include some arbitrary suffix (aka <METHOD> .
Marco Tedone<br />SCJP1.4,SCJP5,SCBCD,SCWCD
Originally posted by Valentin Crettaz:
If you have a quick look at my bean lifecycle cheatsheet (page 1),
Marco Tedone<br />SCJP1.4,SCJP5,SCBCD,SCWCD
Originally posted by Marco Tedone:
So, if we are talking about entity beans, when ejbRemove() is invoked, is the bean instance put in the pool without ejbPassivate being invoked?
Marco
SCJP 1.4 / 5.0 - SCBCD 1.3 - SCWCD 1.4 - IBM 484
Consider Paul's rocket mass heater. |