Java Reference
In-Depth Information
In this chapter, we focus primarily on the EJB-JAR module and the EAR modules as well
as JPA and CDI. JPA entities are special. They don't have a specific module type of their
own. Instead, entities can be packaged as part of most module types. For example, the abil-
ity to package entities in WARs allows you to use the EJB 3 JPA in web applications. Entit-
ies can also be packaged inside EJB-JAR modules allowing business logic to retrieve and
alter business data. Standalone EJB Java clients can also contain entities, though use of
entities in EJB Java clients is usually limited to the standalone client's runtime and config-
uration data, not core business data—that's what the EJBs are for. Entities aren't supported
in RARs.
If entities are special, why doesn't Java EE have a different module type to package entit-
ies? After all, JBoss has the Hibernate Archive (HAR) to package persistence objects with
Hibernate's O/R framework. You may know the answer to this question if you've followed
the evolution of the EJB 3 specification. For those who haven't, we now regale you with
“Tales from the Expert Group” (cue spooky music).
During the evolution of the EJB 3 public draft, the Persistence Archive (PAR) was intro-
duced, which mysteriously vanished in the proposed final draft. The EJB and Java EE ex-
pert groups fought a huge, emotional battle over whether to introduce a module type for
a persistence module at the Java EE level, and they sought suggestions from the commu-
nity at large, as well as from various developer forums. Many developers think a separ-
ate persistence module is a bad idea because entities are supported both outside and inside
the container. Considering that persistence is inherently a part of any application, it makes
sense to support packaging entities with most module types, instead of introducing a new
module type specialized for packaging entities. Now that you know what modules are sup-
ported and a little about how they were arrived at, shall we take a quick peek under the
hood of an EAR module?
13.1.1. Dissecting the Java EE module system
The Java EE module system is based on the EAR file, which is the top-level module
containing all other Java EE modules for deployment. So to understand how deployment
works, let's take a closer look at the EAR file. We'll start with an example from Ac-
tionBazaar.
Search WWH ::




Custom Search