You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2012/02/21 04:54:01 UTC

svn commit: r805588 - in /websites/production/openejb: ./ content/jpa-concepts.html

Author: dblevins
Date: Tue Feb 21 03:54:01 2012
New Revision: 805588

Log:
Publishing merge to openejb site by dblevins

Modified:
    websites/production/openejb/   (props changed)
    websites/production/openejb/content/jpa-concepts.html

Propchange: websites/production/openejb/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Tue Feb 21 03:54:01 2012
@@ -1 +1 @@
-1291550
+1291570

Propchange: websites/production/openejb/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 21 03:54:01 2012
@@ -1 +1 @@
-/websites/staging/openejb/trunk:790824-805580
+/websites/staging/openejb/trunk:790824-805583

Modified: websites/production/openejb/content/jpa-concepts.html
==============================================================================
--- websites/production/openejb/content/jpa-concepts.html (original)
+++ websites/production/openejb/content/jpa-concepts.html Tue Feb 21 03:54:01 2012
@@ -149,51 +149,61 @@ touch or feel from a coding perspective.
 <p>Here's a quick cheat sheet of the JPA world:</p>
 
 <ul>
-<li>A <em>Cache</em> is a <em>copy of data</em>, copy meaning pulled from but living
+<li>A <strong>Cache</strong> is a <strong>copy of data</strong>, copy meaning pulled from but living
 outside the database.</li>
-<li><em>Flushing</em> a Cache is the act of putting modified data back into the
+<li><strong>Flushing</strong> a Cache is the act of putting modified data back into the
 database.</li>
-<li>A <em>PersistenceContext</em> is essentially a Cache. It also tends to have
+<li>A <strong>PersistenceContext</strong> is essentially a Cache. It also tends to have
 it's own non-shared database connection.</li>
-<li>An <em>EntityManager</em> represents a PersistenceContext (and therefore a
+<li>An <strong>EntityManager</strong> represents a PersistenceContext (and therefore a
 Cache)</li>
-<li>An <em>EntityManagerFactory</em> creates an EntityManager (and therefore a
+<li>An <strong>EntityManagerFactory</strong> creates an EntityManager (and therefore a
 PersistenceContext/Cache)</li>
-<li>With <persistence-unit transaction-type="*RESOURCE_LOCAL*"> <em>you</em> are
+</ul>
+
+<p>Comparing <code>EntityManager</code> and <code>EntityManagerFactory</code></p>
+
+<p>With &lt;persistence-unit transaction-type="<strong>RESOURCE_LOCAL</strong>"> <strong>you</strong> are
 responsible for EntityManager (PersistenceContext/Cache) creating and
-tracking...
--- You <em>must</em> use the <em>EntityManagerFactory</em> to get an EntityManager
--- The resulting <em>EntityManager</em> instance <em>is</em> a
-PersistenceContext/Cache
--- An <em>EntityManagerFactory</em> can be injected via the <em>@PersistenceUnit</em>
-annotation only (not @PersistenceContext)
--- You are <em>not</em> allowed to use @PersistenceContext to refer to a unit
-of type RESOURCE_LOCAL
--- You <em>must</em> use the <em>EntityTransaction</em> API to begin/commit around
-<em>every</em> call to your EntityManger
--- Calling entityManagerFactory.createEntityManager() twice results in
-<em>two</em> separate EntityManager instances and therefor <em>two</em> separate
-PersistenceContexts/Caches.
--- It is <em>almost never</em> a good idea to have more than one <em>instance</em> of
+tracking...</p>
+
+<ul>
+<li>You <strong>must</strong> use the <strong>EntityManagerFactory</strong> to get an EntityManager</li>
+<li>The resulting <strong>EntityManager</strong> instance <strong>is</strong> a
+PersistenceContext/Cache</li>
+<li>An <strong>EntityManagerFactory</strong> can be injected via the <strong>@PersistenceUnit</strong>
+annotation only (not @PersistenceContext)</li>
+<li>You are <strong>not</strong> allowed to use @PersistenceContext to refer to a unit
+of type RESOURCE_LOCAL</li>
+<li>You <strong>must</strong> use the <strong>EntityTransaction</strong> API to begin/commit around
+<strong>every</strong> call to your EntityManger</li>
+<li>Calling entityManagerFactory.createEntityManager() twice results in
+<strong>two</strong> separate EntityManager instances and therefor <strong>two</strong> separate
+PersistenceContexts/Caches.</li>
+<li>It is <strong>almost never</strong> a good idea to have more than one <strong>instance</strong> of
 an EntityManager in use (don't create a second one unless you've destroyed
 the first)</li>
-<li>With <persistence-unit transaction-type="*TRANSACTION*"> the <em>container</em>
-will do EntityManager (PersistenceContext/Cache) creating and tracking...
--- You <em>cannot</em> use the <em>EntityManagerFactory</em> to get an EntityManager
--- You can only get an <em>EntityManager</em> supplied by the <em>container</em>
--- An <em>EntityManager</em> can be injected via the <em>@PersistenceContext</em>
-annotation only (not @PersistenceUnit)
--- You are <em>not</em> allowed to use @PersistenceUnit to refer to a unit of
-type TRANSACTION
--- The <em>EntityManager</em> given by the container is a <em>reference</em> to the
-PersistenceContext/Cache associated with a JTA Transaction.
--- If no JTA transaction is in progress, the EntityManager <em>cannot be
-used</em> because there is no PersistenceContext/Cache.
--- Everyone with an EntityManager reference to the <em>same unit</em> in the
-<em>same transaction</em> will automatically have a reference to the <em>same
-PersistenceContext/Cache</em>
--- The PersistenceContext/Cache is <em>flushed</em> and cleared at JTA
-<em>commit</em> time</li>
+</ul>
+
+<p>With &lt;persistence-unit transaction-type="<strong>TRANSACTION</strong>"> the <strong>container</strong>
+will do EntityManager (PersistenceContext/Cache) creating and tracking...</p>
+
+<ul>
+<li>You <strong>cannot</strong> use the <strong>EntityManagerFactory</strong> to get an EntityManager</li>
+<li>You can only get an <strong>EntityManager</strong> supplied by the <strong>container</strong></li>
+<li>An <strong>EntityManager</strong> can be injected via the <strong>@PersistenceContext</strong>
+annotation only (not @PersistenceUnit)</li>
+<li>You are <strong>not</strong> allowed to use @PersistenceUnit to refer to a unit of
+type TRANSACTION</li>
+<li>The <strong>EntityManager</strong> given by the container is a <strong>reference</strong> to the
+PersistenceContext/Cache associated with a JTA Transaction.</li>
+<li>If no JTA transaction is in progress, the EntityManager <strong>cannot be
+used</strong> because there is no PersistenceContext/Cache.</li>
+<li>Everyone with an EntityManager reference to the <strong>same unit</strong> in the
+<strong>same transaction</strong> will automatically have a reference to the <strong>same
+PersistenceContext/Cache</strong></li>
+<li>The PersistenceContext/Cache is <strong>flushed</strong> and cleared at JTA
+<strong>commit</strong> time</li>
 </ul>
 
 <p><a name="JPAConcepts-Cache==PersistenceContext"></a></p>
@@ -227,17 +237,17 @@ against the current transaction.</p>
 
 <h1>Caches and Detaching</h1>
 
-<p>Detaching is the concept of a persistent object <em>leaving</em> the
+<p>Detaching is the concept of a persistent object <strong>leaving</strong> the
 PersistenceContext/Cache.  Leaving means that any updates made to the
-object are <em>not</em> reflected in the PersistenceContext/Cache.  An object will
-become Detached if it somehow <em>lives longer</em> or is <em>used outside</em> the scope
+object are <strong>not</strong> reflected in the PersistenceContext/Cache.  An object will
+become Detached if it somehow <strong>lives longer</strong> or is <strong>used outside</strong> the scope
 of the PersistenceContext/Cache.  </p>
 
 <p>For a TRANSACTION unit, the PersistenceContext/Cache will live as long as
 the transaction does.  When a transaction completes (commits or rollsback)
 all objects that were in the PersistenceContext/Cache are Detached.  You
 can still use them, but they are no longer associated with a
-PersistenceContext/Cache and modifications on them will <em>not</em> be reflected
+PersistenceContext/Cache and modifications on them will <strong>not</strong> be reflected
 in a PersistenceContext/Cache and therefore not the database either.</p>
 
 <p>Serializing objects that are currently in a PersistenceContext/Cache will
@@ -256,7 +266,7 @@ and exceptions to be thrown.  If you wis
 persistent objects it is always a good idea to iterate over the Collection
 at least once.</p>
 
-<p>You <em>cannot</em> call EntityManager.persist() or EntityManager.remove() on a
+<p>You <strong>cannot</strong> call EntityManager.persist() or EntityManager.remove() on a
 Detached object.</p>
 
 <p>Calling EntityManager.merge() will re-attach a Detached object.</p>