Author: buildbot
Date: Mon Jul 17 09:11:46 2023
New Revision: 1083654
Log:
Production update by buildbot for tapestry
Modified:
websites/production/tapestry/content/cache/main.pageCache
websites/production/tapestry/content/integrating-with-jpa.html
Modified: websites/production/tapestry/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.
Modified: websites/production/tapestry/content/integrating-with-jpa.html
==============================================================================
--- websites/production/tapestry/content/integrating-with-jpa.html (original)
+++ websites/production/tapestry/content/integrating-with-jpa.html Mon Jul 17
09:11:46 2023
@@ -147,13 +147,14 @@
<div class="aui-message aui-message-info macro-since"><b
class="param-since">Added in 5.3</b>
+ <div class="param-body"></div>
</div><p>Tapestry provides a built-in integration with the Java Persistence
API (JPA) through the <strong>Tapestry-jpa</strong> module. This module
supersedes the 3rd-party <a class="external-link"
href="http://www.tynamo.org/tapestry-jpa+guide/" rel="nofollow">Tynamo JPA
module</a>.</p><p><strong>Contents</strong></p><p><style
type="text/css">/*<![CDATA[*/
-div.rbtoc1669470764201 {padding: 0px;}
-div.rbtoc1669470764201 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1669470764201 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1689585101048 {padding: 0px;}
+div.rbtoc1689585101048 ul {margin-left: 0px;}
+div.rbtoc1689585101048 li {margin-left: 0px;padding-left: 0px;}
-/*]]>*/</style></p><div class="toc-macro rbtoc1669470764201">
+/*]]>*/</style></p><div class="toc-macro rbtoc1689585101048">
<ul class="toc-indentation"><li><a
href="#IntegratingwithJPA-Downloading">Downloading</a>
<ul class="toc-indentation"><li><a
href="#IntegratingwithJPA-SelectingaJPAImplementation">Selecting a JPA
Implementation</a></li></ul>
</li><li><a href="#IntegratingwithJPA-ConfiguringJPA">Configuring JPA</a>
@@ -238,7 +239,7 @@ div.rbtoc1669470764201 li {margin-left:
cfg.add("JTAUnit", configurer);
}
}</code></pre>
-</div></div><p>In the example above you can see a contribution to the
<em>EntityManagerSource</em> service. This service is responsible for creating
the <a class="external-link"
href="http://download.oracle.com/javaee/6/api/javax/persistence/EntityManagerFactory.html"
rel="nofollow">EntityManagerFactory</a> to be used to create <a
class="external-link"
href="http://download.oracle.com/javaee/6/api/javax/persistence/EntityManager.html"
rel="nofollow">EntityManager</a>. When the service is initialized, it parses
the <em>persistence.xml</em> file, if available. For any persistence unit
defined in the XML descriptor a <em>TapestryPersistenceUnitInfo</em> object is
created. The <em>TapestryPersistenceUnitInfo</em> interface is a mutable
extension of the <a class="external-link"
href="http://download.oracle.com/javaee/6/api/javax/persistence/spi/PersistenceUnitInfo.html"
rel="nofollow">PersistenceUnitInfo</a> interface (defined in the JPA
specification) that allows you to configure a pers
istence unit programmatically.</p><p>After parsing the persistence descriptor,
the EntityManagerSource service applies its configuration to create further
persistence units and/or update the existing ones. The service’s
configuration is a map in which persistence unit names are associated with
<em>PersistenceUnitConfigurer</em> instances. A PersistenceUnitConfigurer is
used to configure a persistence unit programmatically that has been associated
with it. In the example above you can see a contribution providing a
PersistenceUnitConfigurer for the unit named <em>JTAUnit</em>.</p><div
class="confluence-information-macro
confluence-information-macro-information"><span class="aui-icon aui-icon-small
aui-iconfont-info confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>Note that the
TapestryPersistenceUnitInfo instance passed to the PersistenceUnitConfigurer is
either empty or my contain the persistence unit metadata read from the
persistenc
e.xml file. What happens if you contribute a PersistenceUnitConfigurer for a
persistence unit that has not been defined in the persistence.xml file? In this
case Tapestry assumes that you want to configure the persistence unit
programmatically and just creates a fresh <em>TapestryPersistenceUnitInfo</em>
object and passes it to the
<em>PersistenceUnitConfigurer</em>.</p></div></div><h2
id="IntegratingwithJPA-Automaticallyaddingmanagedclasses">Automatically adding
managed classes</h2><p>If only a single persistence unit is defined, Tapestry
scans the <em>application-root-package.entities</em> package. The classes in
that package are automatically added as managed classes to the defined
persistence unit.</p><p>If you have additional packages containing entities,
you may contribute them to the <em>JpaEntityPackageManager</em> service
configuration.</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>AppM
odule.java (partial)</b></div><div class="codeContent panelContent pdl">
+</div></div><p>In the example above you can see a contribution to the
<em>EntityManagerSource</em> service. This service is responsible for creating
the <a class="external-link"
href="http://download.oracle.com/javaee/6/api/javax/persistence/EntityManagerFactory.html"
rel="nofollow">EntityManagerFactory</a> to be used to create <a
class="external-link"
href="http://download.oracle.com/javaee/6/api/javax/persistence/EntityManager.html"
rel="nofollow">EntityManager</a>. When the service is initialized, it parses
the <em>persistence.xml</em> file, if available. For any persistence unit
defined in the XML descriptor a <em>TapestryPersistenceUnitInfo</em> object is
created. The <em>TapestryPersistenceUnitInfo</em> interface is a mutable
extension of the <a class="external-link"
href="http://download.oracle.com/javaee/6/api/javax/persistence/spi/PersistenceUnitInfo.html"
rel="nofollow">PersistenceUnitInfo</a> interface (defined in the JPA
specification) that allows you to configure a pers
istence unit programmatically.</p><p>After parsing the persistence descriptor,
the EntityManagerSource service applies its configuration to create further
persistence units and/or update the existing ones. The service’s
configuration is a map in which persistence unit names are associated with
<em>PersistenceUnitConfigurer</em> instances. A PersistenceUnitConfigurer is
used to configure a persistence unit programmatically that has been associated
with it. In the example above you can see a contribution providing a
PersistenceUnitConfigurer for the unit named <em>JTAUnit</em>.</p><div
class="confluence-information-macro
confluence-information-macro-information"><span class="aui-icon aui-icon-small
aui-iconfont-info confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>Note that the
TapestryPersistenceUnitInfo instance passed to the PersistenceUnitConfigurer is
either empty or may contain the persistence unit metadata read from the
persisten
ce.xml file. What happens if you contribute a PersistenceUnitConfigurer for a
persistence unit that has not been defined in the persistence.xml file? In this
case Tapestry assumes that you want to configure the persistence unit
programmatically and just creates a fresh <em>TapestryPersistenceUnitInfo</em>
object and passes it to the
<em>PersistenceUnitConfigurer</em>.</p></div></div><h2
id="IntegratingwithJPA-Automaticallyaddingmanagedclasses">Automatically adding
managed classes</h2><p>If only a single persistence unit is defined, Tapestry
scans the <em>application-root-package.entities</em> package. The classes in
that package are automatically added as managed classes to the defined
persistence unit.</p><p>If you have additional packages containing entities,
you may contribute them to the <em>JpaEntityPackageManager</em> service
configuration.</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>App
Module.java (partial)</b></div><div class="codeContent panelContent pdl">
<pre><code class="language-java">public class AppModule {
@Contribute(JpaEntityPackageManager.class)