| <html><head> |
| <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
| <title>Chapter 8. Deployment</title><link rel="stylesheet" href="css/docbook.css" type="text/css"><base href="display"><meta name="generator" content="DocBook XSL Stylesheets V1.72.0"><link rel="start" href="manual.html" title="Apache OpenJPA 2.1 User's Guide"><link rel="up" href="ref_guide.html" title="Part 3. Reference Guide"><link rel="prev" href="ref_guide_orphan.html" title="11. Orphaned Keys"><link rel="next" href="ref_guide_enterprise_trans.html" title="2. 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 8. |
| Deployment |
| </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ref_guide_orphan.html">Prev</a> </td><th width="60%" align="center">Part 3. Reference Guide</th><td width="20%" align="right"> <a accesskey="n" href="ref_guide_enterprise_trans.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en" id="ref_guide_deploy"><div class="titlepage"><div><div><h2 class="title"><a name="ref_guide_deploy"></a>Chapter 8. |
| 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" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="ref_guide_deploy_factory"></a>1. |
| 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" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="ref_guide_deploy_factory_standalone"></a>1.1. |
| Standalone Deployment |
| </h3></div></div></div><a class="indexterm" name="d0e31581"></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 href="jpa_overview_persistence.html" title="Chapter 6. Persistence">Chapter 6, <i xmlns:xlink="http://www.w3.org/1999/xlink"> |
| 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 xmlns:xlink="http://www.w3.org/1999/xlink" 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" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="ref_guide_deploy_inject"></a>1.2. |
| EntityManager Injection |
| </h3></div></div></div><p> |
| Java EE 5 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> </td><td width="20%" align="center"><a accesskey="u" href="ref_guide.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ref_guide_enterprise_trans.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">11. |
| Orphaned Keys |
| </td><td width="20%" align="center"><a accesskey="h" href="manual.html">Home</a></td><td width="40%" align="right" valign="top"> 2. |
| Integrating with the Transaction Manager |
| </td></tr></table></div></body></html> |