2006-08-24 16:41:12 -04:00
|
|
|
<chapter id="ref_guide_deploy">
|
|
|
|
<title>
|
|
|
|
Deployment
|
|
|
|
</title>
|
|
|
|
<para>
|
|
|
|
OpenJPA deployment includes choosing a factory deployment strategy, and in a
|
|
|
|
managed environment, optionally integrating with your application server's
|
|
|
|
managed and XA transactions. This chapter examines each aspect of deployment in
|
|
|
|
turn.
|
2006-08-22 17:28:53 -04:00
|
|
|
</para>
|
2006-08-24 16:41:12 -04:00
|
|
|
<section id="ref_guide_deploy_factory">
|
|
|
|
<title>
|
|
|
|
Factory Deployment
|
|
|
|
</title>
|
|
|
|
<para>
|
2006-10-02 18:22:18 -04:00
|
|
|
OpenJPA offers several <classname>EntityManagerFactory</classname>
|
|
|
|
deployment options.
|
2006-08-24 16:41:12 -04:00
|
|
|
</para>
|
2006-08-22 17:28:53 -04:00
|
|
|
<section id="ref_guide_deploy_factory_standalone">
|
2006-08-24 16:41:12 -04:00
|
|
|
<title>
|
|
|
|
Standalone Deployment
|
|
|
|
</title>
|
|
|
|
<indexterm zone="ref_guide_deploy_factory_standalone">
|
|
|
|
<primary>
|
|
|
|
deployment
|
|
|
|
</primary>
|
|
|
|
<secondary>
|
|
|
|
standalone
|
|
|
|
</secondary>
|
|
|
|
<seealso>
|
|
|
|
Persistence
|
|
|
|
</seealso>
|
2006-08-22 17:28:53 -04:00
|
|
|
</indexterm>
|
|
|
|
<para>
|
2006-08-24 16:41:12 -04:00
|
|
|
The JPA Overview describes the <classname>javax.persistence.Persistence
|
|
|
|
</classname> class. You can use <classname>Persistence</classname> to obtain
|
|
|
|
<classname>EntityManagerFactory</classname> instances, as demonstrated in
|
2006-09-05 15:28:36 -04:00
|
|
|
<xref linkend="jpa_overview_persistence"/>. OpenJPA also extends
|
2006-08-24 16:41:12 -04:00
|
|
|
<classname>Persistence</classname> to add additional <classname>
|
|
|
|
EntityManagerFactory</classname> creation methods. The <classname>
|
|
|
|
org.apache.openjpa.persistence.OpenJPAPersistence</classname> class
|
2006-10-02 18:22:18 -04:00
|
|
|
<ulink url="../apidocs/org/apache/openjpa/persistence/OpenJPAPersistence.html">
|
|
|
|
Javadoc</ulink> details these extensions.
|
2006-08-24 16:41:12 -04:00
|
|
|
</para>
|
2006-08-22 17:28:53 -04:00
|
|
|
<para>
|
2006-10-02 18:22:18 -04:00
|
|
|
After obtaining the factory, you can cache it for all <classname>
|
|
|
|
EntityManager</classname> creation duties.
|
2006-08-24 16:41:12 -04:00
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
<section id="ref_guide_deploy_inject">
|
|
|
|
<title>
|
|
|
|
EntityManager Injection
|
|
|
|
</title>
|
|
|
|
<!-- ### -->
|
2006-08-22 17:28:53 -04:00
|
|
|
<para>
|
2006-08-24 16:41:12 -04:00
|
|
|
TBD
|
|
|
|
</para>
|
2006-08-22 17:28:53 -04:00
|
|
|
</section>
|
2006-08-24 16:41:12 -04:00
|
|
|
</section>
|
|
|
|
<section id="ref_guide_enterprise_xa">
|
|
|
|
<title>
|
|
|
|
XA Transactions
|
|
|
|
</title>
|
2006-08-22 17:28:53 -04:00
|
|
|
<indexterm zone="ref_guide_enterprise_xa">
|
2006-08-24 16:41:12 -04:00
|
|
|
<primary>
|
|
|
|
transactions
|
|
|
|
</primary>
|
|
|
|
<secondary>
|
|
|
|
XA
|
|
|
|
</secondary>
|
2006-08-22 17:28:53 -04:00
|
|
|
</indexterm>
|
|
|
|
<indexterm>
|
2006-08-24 16:41:12 -04:00
|
|
|
<primary>
|
|
|
|
XA transactions
|
|
|
|
</primary>
|
|
|
|
<see>
|
|
|
|
transactions
|
|
|
|
</see>
|
2006-08-22 17:28:53 -04:00
|
|
|
</indexterm>
|
|
|
|
<para>
|
2006-08-24 16:41:12 -04:00
|
|
|
The X/Open Distributed Transaction Processing (X/Open DTP) model, designed by
|
|
|
|
<ulink url="http://www.xopen.org">Open Group</ulink> (a vendor consortium),
|
|
|
|
defines a standard communication architecture that provides the following:
|
2006-08-22 17:28:53 -04:00
|
|
|
</para>
|
2006-08-24 16:41:12 -04:00
|
|
|
<itemizedlist>
|
2006-08-22 17:28:53 -04:00
|
|
|
<listitem>
|
2006-08-24 16:41:12 -04:00
|
|
|
<para>
|
|
|
|
Concurrent execution of applications on shared resources.
|
|
|
|
</para>
|
2006-08-22 17:28:53 -04:00
|
|
|
</listitem>
|
|
|
|
<listitem>
|
2006-08-24 16:41:12 -04:00
|
|
|
<para>
|
|
|
|
Coordination of transactions across applications.
|
|
|
|
</para>
|
2006-08-22 17:28:53 -04:00
|
|
|
</listitem>
|
|
|
|
<listitem>
|
2006-08-24 16:41:12 -04:00
|
|
|
<para>
|
|
|
|
Components, interfaces, and protocols that define the architecture and provide
|
|
|
|
portability of applications.
|
|
|
|
</para>
|
2006-08-22 17:28:53 -04:00
|
|
|
</listitem>
|
2006-08-24 16:41:12 -04:00
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Atomicity of transaction systems.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Single-thread control and sequential function-calling.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</itemizedlist>
|
|
|
|
<para>
|
|
|
|
The X/Open DTP XA standard defines the application programming interfaces that a
|
|
|
|
resource manager uses to communicate with a transaction manager. The XA
|
|
|
|
interfaces enable resource managers to join transactions, to perform two-phase
|
|
|
|
commit, and to recover in-doubt transactions following a failure.
|
|
|
|
</para>
|
|
|
|
<section id="ref_guide_enterprise_xa_req">
|
|
|
|
<title>
|
|
|
|
Using OpenJPA with XA Transactions
|
|
|
|
</title>
|
|
|
|
<para>
|
|
|
|
OpenJPA supports XA-compliant transactions when used in a properly configured
|
|
|
|
managed environment. The following components are required:
|
|
|
|
</para>
|
|
|
|
<itemizedlist>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
A managed environment that provides an XA compliant transaction manager.
|
|
|
|
Examples of this are application servers such as JBoss and WebLogic.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Instances of a <classname>javax.sql.XADataSource</classname> for each of the
|
|
|
|
<classname>DataSource</classname>s that OpenJPA will use.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</itemizedlist>
|
|
|
|
<para>
|
|
|
|
Given these components, setting up OpenJPA to participate in distributed
|
|
|
|
transactions is a simple two-step process:
|
|
|
|
</para>
|
|
|
|
<orderedlist>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Point OpenJPA at an enlisted <classname>XADataSource</classname>, and configure
|
|
|
|
a second non-enlisted data source. See
|
2006-09-05 15:28:36 -04:00
|
|
|
<xref linkend="ref_guide_dbsetup_thirdparty_enlist"/>.
|
2006-08-24 16:41:12 -04:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</orderedlist>
|
2006-08-22 17:28:53 -04:00
|
|
|
</section>
|
2006-08-24 16:41:12 -04:00
|
|
|
</section>
|
|
|
|
</chapter>
|