Amazon Ads

2013年10月1日 星期二

[筆記]在Stateless Session Bean的方法中允許的操作

Bean方法
允許的操作
建構子
Dependency injection methods (setter methods).SessionContext:
getEJBHome,
getEJBLocalHome,
lookup.

JNDI Access: Available
PostConstruct, PreDestroy methods (lifecycle
callback methods).
SessionContext:
getBusinessObject,
getEJBHome,
getEJBLocalHome,
getEJBObject,
getEJBLocalObject,
lookup,
getContextData,
getTimerService,
getUserTransaction (BMT only)

JNDI Access: Available
EntityManagerFactory: Accessible
Business method from any view or business method interceptor methodSessionContext:
getBusinessObject,
getEJBHome,
getEJBLocalHome,
getCallerPrincipal,
isCallerInRole,
getEJBObject,
getEJBLocalObject,
lookup,
getContextData,
getInvokedBusinessInterface,
wasCancelCalled,
getTimerService,
getUserTransaction (BMT only)
getRollbackOnly (CMT only)
setRollbackOnly (CMT only)
JNDI Access: Available
Resource managers: Accessible
Other EJBs: Accessible
EntityManagerFactory: Accessible
EntityManager: Accessible
Timer and TimeService methods: Accessbile
UserTransaction methods: Accessible (BMT only)
Business methods from web service endpoint.SessionContext:
getBusinessObject,
getEJBHome,
getEJBLocalHome,
getCallerPrincipal,
isCallerInRole,
getEJBObject,
getEJBLocalObject,
lookup,
getContextData,
getTimerService,
getMessageContext,
getUserTransaction (BMT only),
getRollbackOnly (CMT only),
setRollbackOnly (CMT only).
MessageContext methods: Available
JNDI Access: Available
Resource managers: Accessible.
Other EJBs: Accessible.
EntityManagerFactory: Accessible.
EntityManager: Accessible.
Timer and TimerService methods: Accessible.
UserTransaction methods: Accessible (BMT only).
Timeout callback method.SessionContext:
getBusinessObject,
getEJBHome,
getEJBLocalHome,
getCallerPrincipal,
isCallerInRole,
getEJBObject,
getEJBLocalObject,
lookup,
getContextData,
getTimerService,
getUserTransaction (BMT only),
getRollbackOnly (CMT only),
setRollbackOnly (CMT only).
JNDI Access: Available
Resource managers: Accessible.
Other EJBs: Accessible.
EntityManagerFactory: Accessible.
EntityManager: Accessible.
Timer and TimerService methods: Accessible.
UserTransaction methods: Accessible (BMT only).

ps.

  1. BMT表Bean Managed Transaction
  2. CMT表Container Managed Transaction

若在@PostConstruct和@PreDestroy中進行下列操作,則IllegalStateException會被丟出
呼叫對象
方法名稱
SesssionContext methodsSecurity related:
getCallerPrincipal,
isCallerInRole.
Transaction related:
getRollbackOnly,
setRollbackOnly
Asynchronous related methodswasCancelCalled
Client related SessionConext methodsgetInvokedBusinessInterface
TimerService and TimerAll methods

節錄自:http://www.slideshare.net/krizsan/ocp-jbcd-6-study-notes,p.47

沒有留言: