The EntityBean interface adds three new container callbacks (including two just for synchronization)

image with no caption

The EntityBean interface adds three new methods (and the context setter changes to give the bean an EntityContext instead of a SessionContext). But... and this is an extremely large “but”... even the methods which are the same in both interfaces don’t behave the same.

Of the four methods in SessionBean, only the context setter behaves the same as its counterpart in EntityBean. The other three, ejbPassivate(), ejbActivate(), and ejbRemove() have drastically different meanings.

You’ll see.

For now, just be ready to let go of your attachments to the meaning of activation, passivation, and removal. What those mean to an entity bean is nothing like what they mean to a session bean.

Get Head First EJB now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.