Application?
This section describes the following:
• Understanding Packaging
• Understanding Deployment
• Understanding EJB Deployment Descriptor Files
Understanding Packaging
The Java EE architecture provides a variety of ways to package (or
assemble) your application and its various Java EE components.
Understanding Deployment
After you package your Java EE application, to execute the application
and make it available to end users, you deploy it to OC4J.
OC4J deploys EJB modules in the order in which they appear in the
application.xml deployment descriptor. In general, loading order is
component-specific and based on natural ordering for each component
type.
<application>
<display-name>master-application</display-name>
<module>
<ejb>ejb1.jar</ejb>
</module>
<module>
<ejb>ejb2.jar</ejb>
</module>
<module>
<java>appclient.jar</java>
</module>
<module>
<web>
<web-uri>clientweb.war</web-uri>
<context-root>webapp</context-root>
</web>
</module>
<module>
<ejb>ejb3.jar</ejb>
</module>
1. ejb1
2. ejb2
3. ejb3
4. clientweb.war
5. appclient.jar
EJB
JPA 2.1 Message-
Deployment Sessio Entit Entity Driven EJB
Descriptor File n Bean y Bean Bean 3.0 EJB 2.1
"What is the Option Required
ejb-jar.xml File?" al
EJB 3.0
If you are using EJB 3.0, this deployment descriptor file is optional: you
can use annotations instead. In this release, OC4J supports the use of
both EJB 3.0 annotations and ejb-jar.xml for all options of session
and message-driven beans. The ejb-jar.xml file is not used for EJB
3.0 entities. Configuration in the ejb-jar.xml file overrides
annotations (see "Overriding Annotations With Deployment Descriptor
Entries").
For EJB 30. entities, you must either use annotations or TopLink JPA
persistence provider deployment XML files (toplink-ejb-jar.xml
and ejb3-toplink-sessions.xml).
EJB 2.1
If you are using EJB 2.1, this deployment descriptor file is required.
XML Reference
The XML reference for this deployment descriptor file depends on the
EJB version you are using.
For EJB 3.0, this deployment descriptor file conforms to the XML
schema document located at
http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd.
For EJB 2.1, this deployment descriptor file conforms to the XML
schema document located at
http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd.
EJB 3.0
If you are using EJB 3.0, this file is optional. You can deploy without an
orion-ejb-jar.xml file and set OC4J-proprietary options using OC4J-
proprietary annotations (such as @StatelessDeployment,
@StatefulDeployment, and @MessageDrivenDeployment) or
Application Server Control. Vendor extensions set in the orion-ejb-
jar.xml file override extensions set using OC4J-proprietary
annotations. Configuration in the orion-ejb-jar.xml file overrides
annotations (see "Overriding Annotations With Deployment Descriptor
Entries").
If you are using EJB 2.1, orion-ejb-jar.xml file is mandatory for all
OC4J-proprietary options.
For more information, see "Customizing the TopLink EJB 2.1 Persistence
Manager".
XML Reference
Note:
By default, OC4J uses the TopLink Essentials JPA persistence provider.
In this case, you can configure TopLink descriptor-level options
(including mappings) using TopLink JPA extensions ("Accessing TopLink
API at Run Time With TopLink Essentials JPA Persistence").
EJB 3.0
If you are using EJB 3.0 with the default TopLink Essentials JPA
persistence provider, this file is not used.
If you are using EJB 3.0, the toplink-ejb-jar.xml file is only used to
customize TopLink JPA preview persistence provider configuration (see
"Customizing the JPA Persistence Provider"). If you use this file to
customize the TopLink persistence provider, you must also use an
ejb3-toplink-sessions.xml file (see "What is the ejb3-toplink-
sessions.xml File?").
EJB 2.1
If you are using EJB 2.1, the toplink-ejb-jar.xml file is optional. If
you omit this file from your application, you can configure OC4J to
automatically construct it for you (see "Configuring Default
Relationship Generation"). Alternatively, you can use this file to
configure TopLink persistence options yourself (see "Customizing the
TopLink EJB 2.1 Persistence Manager").
XML Reference
Note:
By default, OC4J uses the TopLink Essentials JPA persistence provider.
In this case, you can configure TopLink session-level options using
TopLink JPA extensions ("Accessing TopLink API at Run Time With
TopLink Essentials JPA Persistence").
This file provides a reference to the primary project (see "What is the
toplink-ejb-jar.xml File?"), if used.
EJB 3.0
If you are using EJB 3.0 with the default TopLink Essentials JPA
persistence provider, this file is not used.
EJB 2.1
XML Reference
• Smart Defaulting
• Acquiring an Entity Manager by Default Persistence Unit Name
Smart Defaulting
For EJB modules only, you can rely on OC4J to build a default
persistence.xml file and configure it with appropriate default values
to define a default persistence unit with a default name if:
If your application specifies one and only one persistence unit (either
explicitly or by way of smart defaulting), you need not specify the
persistence unit name when you acquire an entity manager. In this
case, OC4J defaults the persistence unit name.
To disable this feature, set orion-ejb-jar.xml file attribute
disable-default-persistent-unit to true.
If you disable this feature, you can still use the OC4J default
persistence unit if you specify an empty persistence unit in a
persistence.xml file, then, when you acquire an entity manager in
that persistence unit's scope, you do not need to specify a persistence
unit name. In this case, OC4J will use its own default persistence unit
and will assume that all JPA entity classes in the persistence unit root
belong to that persistence unit. You may specify one and only one such
empty persistence unit in your application.
EJB 3.0
EJB 2.1
If you are using EJB 2.1, the persistence.xml file is not used.
XML Reference
For EJB 3.0, this deployment descriptor file conforms to the XML
schema document defined in the EJB 3.0 specification at
http://java.sun.com/products/ejb/docs.html.
You can specify more than one orm.xml file and these files may be
present anywhere on the class path.
EJB 3.0
If you are using EJB 3.0 entities, the orm.xml file is optional.
EJB 2.1
If you are using EJB 2.1, the orm.xml file is not used.
XML Reference
For EJB 3.0, this deployment descriptor file conforms to the XML
schema document defined in the EJB 3.0 specification at
http://java.sun.com/products/ejb/docs.html.