posted 19 years ago
No, 2 is correct because it is pointless for the container to activate a stateful session bean and then destroy it. It will go straight from the "passivated" state to the "does not exist" state without ever getting an ejbRemove() call. As ejbRemove() may never be called, it makes sense to replicate your code (cleanup, finalization, etc) in both ejbPassivate() and ejbRemove().
It's also worth bearing in mind that ejbPassivate() may also never be called. This means that none of your cleanup code may ever get called, so you will need do your cleanup at intervals in case ejbPassivate() or ejbRemove() were never called.
SCJP 1.4, SCWCD 1.3, SCBCD 1.3