Java Reference
In-Depth Information
The interceptor-binding tag defines the binding of interceptors to a particular
EJB with the ejb-name element. If you want to define the default interceptor or an in-
terceptor binding for all EJBs in the EJB module, then you can specify * as the value for
ejb-name . You specify a class to use as the interceptor with the <interceptor-
class> tag. As is evident from the listing, you can specify multiple interceptors in the
same binding, and the order in which they're specified in the deployment descriptor de-
termines the order of execution for the interceptor. In the example, CheckPermis-
sionInterceptor will be executed prior to ActionBazaarDefaultInter-
ceptor when any EJB method is executed.
If you want a refresher on how interceptors work, make a quick detour back to chapter 5
and then rejoin us here. We'll wait.
13.4. JPA packaging
The Java Persistence Architecture (JPA) was part of the EJB 3 specification, but as of EJB
3.2, it has been spun off into its own specification ( http://jcp.org/en/jsr/detail?id=317 ) . The
main reason for this is JPA isn't limited to Java EE. It can be used in a Java Standard applic-
ation as well. Because JPA is now its own specification, we'll highlight the most important
parts as they relate to EJBs. Refer back to chapter 9 for more details about JPA.
13.4.1. Persistence module
Because the specification allows it to be used in any Java application, when it comes to
Java Enterprise application development, JPA entities are simply part of the EJB-JAR or
WAR modules. JPA entities may also be packaged as a regular JAR archive and deployed
in the root of the EAR module. The key is the META-INF/persistence.xml file that des-
ignates the JAR archive, EJB-JAR module, or WAR module as containing one or more
persistence units. We'll take a quick look at how to properly package JPA classes and the
persistence.xml file.
JAR
The following listing shows how to package JPA inside a plain JAR archive.
Search WWH ::




Custom Search