2.1.3 Scope of support for the annotations included in the javax.ejb package

This subsection describes the applicability of annotations of the javax.ejb package. The following sections describe the annotations that you can code in each component:

Organization of this subsection
(1) WAR file (Servlet 3.0 compliant)
(2) WAR file (Supported by Servlet 2.5)
(3) EJB-JAR file (EJB3.1 compliant)
(4) EJB-JAR file (Supported by EJB3.0)
(5) Library JAR file (Servlets or JSPs)
(6) Library JAR file (Enterprise Bean, exception class, or other classes)

(1) WAR file (Servlet 3.0 compliant)

The following table lists the annotations that you can code in a WAR file:

Table 2-10 Annotations (javax.ejb package) that can be coded in WAR file (Servlet 3.0 compliant)

Annotation nameServlet specificationsJSP specificationsException classManage dBean(JSF)Other class
ServletServlet (API)Servlet filterServlet filter (API)Event listenerEvent listener (API)JSP fileTag handlerTag library event listener
Classic tag handlerSimple tag handler
@ApplicationException--------------------Y----
@EJBY--Y--Y----YYN--Y--
@EJBsY--Y--Y----YYN--Y--
Legend:
Y: Supported.
N: Not supported by Application Server.
--: Not supported by standard specifications.

(2) WAR file (Supported by Servlet 2.5)

The following table lists the annotations that you can code in a WAR file:

Table 2-11 Annotations (javax.ejb package) that can be coded in a WAR file (Supported by Servlet 2.5)

Annotation nameServlet specificationsJSP specificationsOther class
ServletServlet filterEvent listenerJSP fileTag handlerTag library event listener
Classic tag handlerSimple tag handler
@EJBYYY--YYN--
@EJBsYYY--YYN--
Legend:
Y: Supported.
N: Not supported by Application Server.
--: Not applicable.

(3) EJB-JAR file (EJB3.1 compliant)

The following table lists the annotations that you can code in an EJB-JAR file:

Table 2-12 Annotations (javax.ejb package) that can be coded in an EJB-JAR file (EJB3.1 compliant)

Annotation nameEnterprise BeanException classOther class
InterfaceSession BeanEntity BeanMessage-driven BeanInterceptor
Other than default InterceptorDefault Interceptor
@AccessTimeout#1--Y------------
@AfterBegin#2--Y------------
@AfterCompletion#3--Y------------
@ApplicationException------------Y--
@Asynchronous#3--Y------------
@BeforeCompletion#2--Y------------
@ConcurrencyManagement#1--Y------------
@DependsOn#1--Y------------
@EJB--Y--NYY----
@EJBs--Y--NYY----
@Init#2--Y------------
@LocalYY------------
@LocalBean--Y------------
@LocalHome--Y------------
@Lock#1--Y------------
@RemoteYY------------
@RemoteHome--Y------------
@Remove#2--Y------------
@Schedule#3--Y--N--------
@Schedules#3--Y--N--------
@Singleton#1--Y------------
@Startup#1--Y------------
@Stateful#2--Y------------
@Stateless#4--Y------------
@Timeout#3--Y--N--------
@TransactionAttribute--Y--N--------
@TransactionManagement--Y--N--------
Legend:
Y: Supported.
N: Not supported by Application Server.
--: Not supported by standard specifications.
#1
Can be used only for Singleton Session Bean.
#2
Can be used only for Stateful Session Bean.
#3
Can be used only for Stateless Session Bean and Singleton Session Bean.
#4
Can be used only for Stateless Session Bean.

(4) EJB-JAR file (Supported by EJB3.0)

The following table lists the annotations that you can code in an EJB-JAR file:

Table 2-13 Annotations (javax.ejb package) that can be coded in an EJB-JAR file (Supported by EJB3.0)

Annotation nameEnterprise BeanException classOther class
InterfaceSession BeanEntity BeanMessage-driven BeanInterceptor
Other than default InterceptorDefault Interceptor
@ApplicationException------------Y--
@EJB--Y--NYY----
@EJBs--Y--NYY----
@Init#1--Y------------
@LocalYY------------
@LocalHome--Y------------
@RemoteYY------------
@RemoteHome--Y------------
@Remove#1--Y------------
@Stateful#1--Y------------
@Stateless#2--Y------------
@Timeout#2--Y--N--------
@TransactionAttribute--Y--N--------
@TransactionManagement--Y--N--------
Legend:
Y: Supported.
N: Not supported by Application Server.
--: Not applicable.
#1
Can be used only for Stateless Session Bean.
#2
Can be used only for Stateful Session Bean.

(5) Library JAR file (Servlets or JSPs)

The following table lists the annotations that you can code in a servlet or JSP of a library JAR file:

Table 2-14 Annotations (javax.ejb package) that can be coded in a library JAR file (Servlets or JSPs)

Annotation nameServlet specificationsJSP specifications
ServletServlet (API)Servlet filterServlet filter (API)Event listenerEvent listener (API)JSP fileTag handlerTag library event listener
Classic tag handlerSimple tag handler
@EJB----Y--Y----YYN
@EJBs----Y--Y----YYN
Legend:
Y: Supported.
N: Not supported by Application Server.
--: Not applicable.

(6) Library JAR file (Enterprise Bean, exception class, or other classes)

The following table lists the annotations that you can code in the Enterprise Beans, exception classes, or the other classes of a library JAR file:

Table 2-15 Annotations (javax.ejb package) that can be coded in a library JAR file (Enterprise Beans, exception classes, or other classes)

Annotation nameEnterprise BeanException classOther class
InterfaceSession BeanEntity BeanMessage-driven BeanInterceptor
@ApplicationException----------Y--
@EJB--------Y----
@EJBs--------Y----
@LocalY------------
@RemoteY------------
Legend:
Y: Supported.
--: Not applicable.