blob: 7dd2b76d68f418e28118ce59cd1d2dc8f6cabb97 [file] [log] [blame]
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Chapter&nbsp;8.&nbsp; Deployment</title><base href="display"><link rel="stylesheet" type="text/css" href="css/docbook.css"><meta name="generator" content="DocBook XSL-NS Stylesheets V1.76.1"><link rel="home" href="manual.html" title="Apache OpenJPA 2.4 User's Guide"><link rel="up" href="ref_guide.html" title="Part&nbsp;3.&nbsp;Reference Guide"><link rel="prev" href="ref_guide_orphan.html" title="11.&nbsp; Orphaned Keys"><link rel="next" href="ref_guide_enterprise_trans.html" title="2.&nbsp; Integrating with the Transaction Manager"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter&nbsp;8.&nbsp;
Deployment
</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ref_guide_orphan.html">Prev</a>&nbsp;</td><th width="60%" align="center">Part&nbsp;3.&nbsp;Reference Guide</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ref_guide_enterprise_trans.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter&nbsp;8.&nbsp; Deployment" id="ref_guide_deploy"><div class="titlepage"><div><div><h2 class="title">Chapter&nbsp;8.&nbsp;
Deployment
</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="ref_guide_deploy.html#ref_guide_deploy_factory">1.
Factory Deployment
</a></span></dt><dd><dl><dt><span class="section"><a href="ref_guide_deploy.html#ref_guide_deploy_factory_standalone">1.1.
Standalone Deployment
</a></span></dt><dt><span class="section"><a href="ref_guide_deploy.html#ref_guide_deploy_inject">1.2.
EntityManager Injection
</a></span></dt></dl></dd><dt><span class="section"><a href="ref_guide_enterprise_trans.html">2.
Integrating with the Transaction Manager
</a></span></dt><dt><span class="section"><a href="ref_guide_enterprise_xa.html">3.
XA Transactions
</a></span></dt><dd><dl><dt><span class="section"><a href="ref_guide_enterprise_xa.html#ref_guide_enterprise_xa_req">3.1.
Using OpenJPA with XA Transactions
</a></span></dt></dl></dd></dl></div>
<p>
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.
</p>
<div class="section" title="1.&nbsp; Factory Deployment"><div class="titlepage"><div><div><h2 class="title" style="clear: both" id="ref_guide_deploy_factory">1.&nbsp;
Factory Deployment
</h2></div></div></div><div class="toc"><dl><dt><span class="section"><a href="ref_guide_deploy.html#ref_guide_deploy_factory_standalone">1.1.
Standalone Deployment
</a></span></dt><dt><span class="section"><a href="ref_guide_deploy.html#ref_guide_deploy_inject">1.2.
EntityManager Injection
</a></span></dt></dl></div>
<p>
OpenJPA offers two <code class="classname">EntityManagerFactory</code>
deployment options.
</p>
<div class="section" title="1.1.&nbsp; Standalone Deployment"><div class="titlepage"><div><div><h3 class="title" id="ref_guide_deploy_factory_standalone">1.1.&nbsp;
Standalone Deployment
</h3></div></div></div>
<a class="indexterm" name="d5e15137"></a>
<p>
The JPA Overview describes the <code class="classname">javax.persistence.Persistence
</code> class. You can use <code class="classname">Persistence</code> to obtain
<code class="classname">EntityManagerFactory</code> instances, as demonstrated in
<a class="xref" href="jpa_overview_persistence.html" title="Chapter&nbsp;6.&nbsp; Persistence">Chapter&nbsp;6, <i>
Persistence
</i></a>. OpenJPA also extends
<code class="classname">Persistence</code> to add additional <code class="classname">
EntityManagerFactory</code> creation methods. The <code class="classname">
org.apache.openjpa.persistence.OpenJPAPersistence</code> class
<a class="ulink" href="../javadoc/org/apache/openjpa/persistence/OpenJPAPersistence.html" target="_top">
Javadoc</a> details these extensions.
</p>
<p>
After obtaining the factory, you can cache it for all <code class="classname">
EntityManager</code> creation duties. OpenJPA factories support being
bound to JNDI as well.
</p>
</div>
<div class="section" title="1.2.&nbsp; EntityManager Injection"><div class="titlepage"><div><div><h3 class="title" id="ref_guide_deploy_inject">1.2.&nbsp;
EntityManager Injection
</h3></div></div></div>
<p>
Java EE application servers allow you to <span class="emphasis"><em>inject</em></span>
entity managers into your session beans using the <code class="literal">PersistenceContext
</code> annotation. See your application server documentation for details.
</p>
</div>
</div>
</div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ref_guide_orphan.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="ref_guide.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="ref_guide_enterprise_trans.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">11.&nbsp;
Orphaned Keys
&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="manual.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;2.&nbsp;
Integrating with the Transaction Manager
</td></tr></table></div></body></html>