posted 19 years ago
Hi,
***********************SLSB********************************************
For SLSB, ejbCreate() and ejbRemove() called ven container wan2 increase/reduce the pool size to handle the client load.@ this time,there is no security ctx or txn ctx associated with the call. So bean instance cannot call ani security/txn related methods.[if u du so, container will throw java.lang.IllegalStateExce..n.]
But ven client calls create() on home obj, EJB specs says, u wan2 assume that corresponding ejbobject is created.[contaner may or may not create an ejbObject. some containers even reuse same ejbobject for all bean insatnce from same home. check containers docs for details].so u can safely call getEJBObject()[or getEJBLocalObject()] on the session ctx.
**********************************************************************
***********************SFSB********************************************
For SFSB, ejbCreate()/ejbRemove() called ven client calls create() or remove() on home object.(there r also other scenarios where ejbRemove() gets called).so the client (& the security ctx ) is always there.But there is no txn ctx associated with the call. So bean instance cannot call ani txn (CMT)related methods.
u can safely call getEJBObject()[or getEJBLocalObject()] on the session ctx since new ejbobject is created for each create() call on home.
**********************************************************************
***********************SB(general)**************************************
ejbPassivate(),ejbActivate(),setSessionCtx(ctx),ejbRemove(),ejbRemove() and afterCompletion(boolean)[onli for CMT] methods r cald with unspecified txn ctx.So u cant call ani txn [CMT]related methods in these methods.
**********************************************************************
***********************SB(BMT)**************************************
For SLSB BMT methods(getting UserTXn obj and calling methods on it) can onli called from Biz methods.
But for SFSB u can call BMT methods in ejbPassivate(),ejbActivate(),setSessionCtx(ctx),ejbRemove(),ejbRemove() and biz methods
**********************************************************************
Binoj V
SCJP 1.4(98%)<br />SCBCD1.3 (100%)<br />SCWCD 1.4 (93%)(w/o prep..n)