Yang,
ejbActivate() and ejbPassivate() works differently for Entity Bean and Session Bean. If you see this link they have criticized
EJB Spec
http://www.onjava.com/pub/a/onjava/2001/02/28/ejb.html For CMP and BMP :- ejbActivate() - When the bean instance is assigned to EJB Object (From Pooled State to Ready State). Once assigned to EJB Object ejbActivate() method is called.
ejbPassivate() - When the bean instance is dissociated with from EJB Object. After this the bean goes to Pooled State (From Ready State to Pooled State)
Stateful Session Bean - When the bean instance is not serving methods from client. To conserve resources the container can passivate bean by calling ejbPassivate(). When the client call a method on EJBObject then the ejbActivate() is called.
I hope I have explained
Thanks