You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by bu...@apache.org on 2014/03/03 18:18:53 UTC
svn commit: r899882 - in /websites/production/camel/content:
cache/main.pageCache jpa.html
Author: buildbot
Date: Mon Mar 3 17:18:53 2014
New Revision: 899882
Log:
Production update by buildbot for camel
Modified:
websites/production/camel/content/cache/main.pageCache
websites/production/camel/content/jpa.html
Modified: websites/production/camel/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.
Modified: websites/production/camel/content/jpa.html
==============================================================================
--- websites/production/camel/content/jpa.html (original)
+++ websites/production/camel/content/jpa.html Mon Mar 3 17:18:53 2014
@@ -105,13 +105,13 @@
<property name="entityManagerFactory" ref="myEMFactory"/>
</bean>
]]></script>
-</div></div><p>In <strong>Camel 2.3</strong> the <code>JpaComponent</code> will auto lookup the <code>EntityManagerFactory</code> from the <a shape="rect" href="registry.html">Registry</a> which means you do not need to configure this on the <code>JpaComponent</code> as shown above. You only need to do so if there is ambiguity, in which case Camel will log a WARN.</p><h3 id="JPA-ConfiguringTransactionManager">Configuring TransactionManager</h3><p>Its strongly advised to configure the <code>TransactionManager</code> instance used by the JPA component. If failed to do so each <code>JpaEndpoint</code> will auto create their own instance of <code>TransactionManager</code> which most often is not what you want.</p><p>For example, you can instantiate a JPA component that references the <code>myTransactionManager</code> transaction manager, as follows:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>In <strong>Camel 2.3</strong> the <code>JpaComponent</code> will auto lookup the <code>EntityManagerFactory</code> from the <a shape="rect" href="registry.html">Registry</a> which means you do not need to configure this on the <code>JpaComponent</code> as shown above. You only need to do so if there is ambiguity, in which case Camel will log a WARN.</p><h3 id="JPA-ConfiguringTransactionManager">Configuring TransactionManager</h3><p>Since <strong>Camel 2.3</strong> the <code>JpaComponent</code> will auto lookup the <code>TransactionManager</code> from the <a shape="rect" href="registry.html">Registry.</a> If Camel won't find any <code>TransactionManager</code> instance registered, it will also look up for the <code>TransactionTemplate</code> and try to extract <code>TransactionManager</code> from it.</p><p>If none <code>TransactionTemplate</code> is available in the registry, <code>JpaEndpoint</code> will auto create their own instance of <code>TransactionMan
ager</code> which most often is not what you want.</p><p>If more than single instance of the <code>TransactionManager</code> is found, Camel will log a WARN. In such cases you might want to instantiate and explicitly configure a JPA component that references the <code>myTransactionManager</code> transaction manager, as follows:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[<bean id="jpa" class="org.apache.camel.component.jpa.JpaComponent">
<property name="entityManagerFactory" ref="myEMFactory"/>
<property name="transactionManager" ref="myTransactionManager"/>
</bean>
]]></script>
-</div></div><p>In <strong>Camel 2.3</strong> the <code>JpaComponent</code> will auto lookup the <code>TransactionManager</code> from the <a shape="rect" href="registry.html">Registry</a> which means you do not need to configure this on the <code>JpaComponent</code> as shown above. You only need to do so if there is ambiguity, in which case Camel will log a WARN.</p><h3 id="JPA-Usingaconsumerwithanamedquery">Using a consumer with a named query</h3><p>For consuming only selected entities, you can use the <code>consumer.namedQuery</code> URI query option. First, you have to define the named query in the JPA Entity class:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><h3 id="JPA-Usingaconsumerwithanamedquery">Using a consumer with a named query</h3><p>For consuming only selected entities, you can use the <code>consumer.namedQuery</code> URI query option. First, you have to define the named query in the JPA Entity class:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[@Entity
@NamedQuery(name = "step1", query = "select x from MultiSteps x where x.step = 1")
public class MultiSteps {