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:
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 name | Servlet specifications | JSP specifications | Exception class | Manage dBean(JSF) | Other class | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Servlet | Servlet (API) | Servlet filter | Servlet filter (API) | Event listener | Event listener (API) | JSP file | Tag handler | Tag library event listener | |||||
Classic tag handler | Simple tag handler | ||||||||||||
@ApplicationException | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | Y | -- | -- |
@EJB | Y | -- | Y | -- | Y | -- | -- | Y | Y | N | -- | Y | -- |
@EJBs | Y | -- | Y | -- | Y | -- | -- | Y | Y | N | -- | Y | -- |
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 name | Servlet specifications | JSP specifications | Other class | |||||
---|---|---|---|---|---|---|---|---|
Servlet | Servlet filter | Event listener | JSP file | Tag handler | Tag library event listener | |||
Classic tag handler | Simple tag handler | |||||||
@EJB | Y | Y | Y | -- | Y | Y | N | -- |
@EJBs | Y | Y | Y | -- | Y | Y | N | -- |
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 name | Enterprise Bean | Exception class | Other class | |||||
---|---|---|---|---|---|---|---|---|
Interface | Session Bean | Entity Bean | Message-driven Bean | Interceptor | ||||
Other than default Interceptor | Default 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 | -- | N | Y | Y | -- | -- |
@EJBs | -- | Y | -- | N | Y | Y | -- | -- |
@Init#2 | -- | Y | -- | -- | -- | -- | -- | -- |
@Local | Y | Y | -- | -- | -- | -- | -- | -- |
@LocalBean | -- | Y | -- | -- | -- | -- | -- | -- |
@LocalHome | -- | Y | -- | -- | -- | -- | -- | -- |
@Lock#1 | -- | Y | -- | -- | -- | -- | -- | -- |
@Remote | Y | Y | -- | -- | -- | -- | -- | -- |
@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 | -- | -- | -- | -- |
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 name | Enterprise Bean | Exception class | Other class | |||||
---|---|---|---|---|---|---|---|---|
Interface | Session Bean | Entity Bean | Message-driven Bean | Interceptor | ||||
Other than default Interceptor | Default Interceptor | |||||||
@ApplicationException | -- | -- | -- | -- | -- | -- | Y | -- |
@EJB | -- | Y | -- | N | Y | Y | -- | -- |
@EJBs | -- | Y | -- | N | Y | Y | -- | -- |
@Init#1 | -- | Y | -- | -- | -- | -- | -- | -- |
@Local | Y | Y | -- | -- | -- | -- | -- | -- |
@LocalHome | -- | Y | -- | -- | -- | -- | -- | -- |
@Remote | Y | Y | -- | -- | -- | -- | -- | -- |
@RemoteHome | -- | Y | -- | -- | -- | -- | -- | -- |
@Remove#1 | -- | Y | -- | -- | -- | -- | -- | -- |
@Stateful#1 | -- | Y | -- | -- | -- | -- | -- | -- |
@Stateless#2 | -- | Y | -- | -- | -- | -- | -- | -- |
@Timeout#2 | -- | Y | -- | N | -- | -- | -- | -- |
@TransactionAttribute | -- | Y | -- | N | -- | -- | -- | -- |
@TransactionManagement | -- | Y | -- | N | -- | -- | -- | -- |
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 name | Servlet specifications | JSP specifications | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Servlet | Servlet (API) | Servlet filter | Servlet filter (API) | Event listener | Event listener (API) | JSP file | Tag handler | Tag library event listener | ||
Classic tag handler | Simple tag handler | |||||||||
@EJB | -- | -- | Y | -- | Y | -- | -- | Y | Y | N |
@EJBs | -- | -- | Y | -- | Y | -- | -- | Y | Y | N |
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 name | Enterprise Bean | Exception class | Other class | ||||
---|---|---|---|---|---|---|---|
Interface | Session Bean | Entity Bean | Message-driven Bean | Interceptor | |||
@ApplicationException | -- | -- | -- | -- | -- | Y | -- |
@EJB | -- | -- | -- | -- | Y | -- | -- |
@EJBs | -- | -- | -- | -- | Y | -- | -- |
@Local | Y | -- | -- | -- | -- | -- | -- |
@Remote | Y | -- | -- | -- | -- | -- | -- |