Java Reference
In-Depth Information
Building an EJB 3.0
Persistence Model with
Oracle JDeveloper
Oracle Fusion Middleware is a family name for a set of Java EE products that are
integrated for SOA and web application deployment. WebLogic Server ( WLS ) is the
Java EE container and Oracle JDeveloper the Java EE and SOA development IDE.
In this chapter, we will use JDeveloper to create an EJB 3.0 application, and then we
will deploy and test our application leveraging the embedded WebLogic Server that
comes with JDeveloper. This makes it very easy for us to develop, deploy, and test
our application.
WebLogic server 10.x provides some value-added features to facilitate EJB
3 development. WebLogic server 10.x supports automatic deployment of a
persistence unit based on the injected variable's name. The @javax.persistence.
PersistenceContext and @javax.persistence.PersistenceUnit
annotations are used to inject the persistence context in an EntityManager or
EntityManagerFactory variable. A persistence context is a set of entities that are
mapped to a database with a global JNDI name. If the name of the injected variable
is the same as the persistence unit, the unitName attribute of the
@PersistenceContext or @PersistenceUnit is not required to be specified. The
EJB container automatically deploys the persistence unit and sets its JNDI name to
be the same as the persistence unit name in persistence.xml . For example, if the
persistence unit name in the persistence.xml file is em , an EntityManager variable
may be injected with the persistence context as follows:
private EntityManager em;
Search WWH ::

Custom Search