uCosminexus Application Server, API Reference Guide

[Contents][Index][Back][Next]

2.1.6 Scope of support for the annotations included in the javax.persistence package

The components in which the annotations of the javax.persistence package can be used differ based on the dependability on the JPA Provider. The annotations that depend on the JPA Provider and the annotations that do not depend on the JPA Provider are described separately:

Organization of this subsection
(1) Annotations that depend on the JPA Provider
(2) Annotations that do not depend on the JPA Provider

(1) Annotations that depend on the JPA Provider

This point describes the applicability of the annotations that depend on the JPA Provider. The annotations that can be coded in each component are as follows:

(a) WAR file (Servlet 3.0 compliant)

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

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

Annotation name Servlet specifications JSP specifications Exception class ManagedBean (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
@PersistenceContext Y -- Y -- Y -- -- Y Y N -- Y --
@PersistenceContexts Y -- Y -- Y -- -- Y Y N -- Y --
@PersistenceProperty Y -- Y -- Y -- -- Y Y N -- Y --
@PersistenceUnit Y -- Y -- Y -- -- Y Y N -- Y --
@PersistenceUnits Y -- Y -- Y -- -- Y Y N -- Y --

Legend:
Y: Supported.
N: Not supported by Application Server.
--: Not supported by standard specifications.

(b) WAR file (Supported by Servlet 2.5)

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

Table 2-19 Annotations (javax.persistence 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
@PersistenceContext Y Y Y -- Y Y N --
@PersistenceContexts Y Y Y -- Y Y N --
@PersistenceProperty Y Y Y -- Y Y N --
@PersistenceUnit Y Y Y -- Y Y N --
@PersistenceUnits Y Y Y -- Y Y N --

Legend:
Y: Supported.
N: Not supported by Application Server.
--: Not applicable.

(c) EJB-JAR file (EJB3.1/EJB3.0 compliant)

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

Table 2-20 Annotations (javax.persistence 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
@PersistenceContext -- Y -- N Y Y -- --
@PersistenceContexts -- Y -- N Y Y -- --
@PersistenceProperty -- Y -- N Y Y -- --
@PersistenceUnit -- Y -- N Y Y -- --
@PersistenceUnits -- Y -- N Y Y -- --

Legend:
Y: Supported.
N: Not supported by Application Server.
--: Not applicable.

(d) 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-21 Annotations (javax.persistence 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
@PersistenceContext -- -- Y -- Y -- -- Y Y N
@PersistenceContexts -- -- Y -- Y -- -- Y Y N
@PersistenceProperty -- -- Y -- Y -- -- Y Y N
@PersistenceUnit -- -- Y -- Y -- -- Y Y N
@PersistenceUnits -- -- Y -- Y -- -- Y Y N

Legend:
Y: Supported.
N: Not supported by Application Server.
--: Not applicable.

(e) 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-22 Annotations (javax.persistence package) that can be coded in a library JAR file (Enterprise Beans, exception classes, or other classes)

Annotation name Enterprise Bean Exception class
Interface Session Bean Entity Bean Message-driven Bean Interceptor
@PersistenceContext -- -- -- N Y --
@PersistenceContexts -- -- -- N Y --
@PersistenceProperty -- -- -- N Y --
@PersistenceUnit -- -- -- N Y --
@PersistenceUnits -- -- -- N Y --

Legend:
Y: Supported.
N: Not supported by Application Server.
--: Not applicable.

(2) Annotations that do not depend on the JPA Provider

Irrespective of the file type, you can use the annotations that do not depend on the JPA Provider, in the entity class.

For details on the list of annotations included in the javax.persistence package, see 2.7 javax.persistence package.