Author: buildbot
Date: Tue Mar 14 11:20:07 2017
New Revision: 1008308

Log:
Production update by buildbot for camel

Modified:
    websites/production/camel/content/book-component-appendix.html
    websites/production/camel/content/book-in-one-page.html
    websites/production/camel/content/cache/main.pageCache
    websites/production/camel/content/camel-219-release.html
    websites/production/camel/content/jpa.html

Modified: websites/production/camel/content/book-component-appendix.html
==============================================================================
--- websites/production/camel/content/book-component-appendix.html (original)
+++ websites/production/camel/content/book-component-appendix.html Tue Mar 14 
11:20:07 2017
@@ -895,16 +895,7 @@ from("direct:keypair").to(&quo
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
 
from(&quot;direct:keystore&quot;).to(&quot;crypto:sign:keystore?keystore=#keystore&amp;alias=bob&amp;password=letmein&quot;,
 &quot;crypto:verify:keystore?keystore=#keystore&amp;alias=bob&quot;, 
&quot;mock:result&quot;);
 ]]></script>
-</div></div>Again in Spring a ref is used to lookup an actual keystore 
instance.<div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
-&lt;route&gt;
-    &lt;from uri=&quot;direct:keystore&quot;/&gt;
-    &lt;to 
uri=&quot;crypto:sign:keystore?keystore=#keystore&amp;amp;alias=bob&amp;amp;password=letmein&quot;
 /&gt;
-    &lt;to 
uri=&quot;crypto:verify:keystore?keystore=#keystore&amp;amp;alias=bob&quot; 
/&gt;
-    &lt;to uri=&quot;mock:result&quot;/&gt;
-&lt;/route&gt;        
-]]></script>
-</div></div><h4 
id="BookComponentAppendix-3)ChangingJCEProviderandAlgorithm">3) Changing JCE 
Provider and Algorithm</h4><p>Changing the Signature algorithm or the Security 
provider is a simple matter of specifying their names. You will need to also 
use Keys that are compatible with the algorithm you choose.</p><div class="code 
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div>Again in Spring a ref is used to lookup an actual keystore 
instance.<div class="error"><span class="error">Error formatting macro: 
snippet: java.lang.IndexOutOfBoundsException: Index: 20, Size: 20</span> 
</div><h4 id="BookComponentAppendix-3)ChangingJCEProviderandAlgorithm">3) 
Changing JCE Provider and Algorithm</h4><p>Changing the Signature algorithm or 
the Security provider is a simple matter of specifying their names. You will 
need to also use Keys that are compatible with the algorithm you 
choose.</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
 keyPair = getKeyPair(&quot;RSA&quot;);
 PrivateKey privateKey = keyPair.getPrivate();
@@ -1011,11 +1002,11 @@ template.send(&quot;direct:alias-verify&
 ]]></script>
 </div></div><p></p><h3 id="BookComponentAppendix-SeeAlso.8">See Also</h3>
 <ul><li><a shape="rect" href="configuring-camel.html">Configuring 
Camel</a></li><li><a shape="rect" 
href="component.html">Component</a></li><li><a shape="rect" 
href="endpoint.html">Endpoint</a></li><li><a shape="rect" 
href="getting-started.html">Getting Started</a></li></ul><ul><li><a 
shape="rect" href="crypto.html">Crypto</a> Crypto is also available as a <a 
shape="rect" href="data-format.html">Data Format</a></li></ul> <h2 
id="BookComponentAppendix-CXFComponent">CXF Component</h2><div 
class="confluence-information-macro confluence-information-macro-note"><span 
class="aui-icon aui-icon-small aui-iconfont-warning 
confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>When using CXF as a consumer, the 
<a shape="rect" href="cxf-bean-component.html">CXF Bean Component</a> allows 
you to factor out how message payloads are received from their processing as a 
RESTful or SOAP web service. This has the potential of using a multitude of 
transports to cons
 ume web services. The bean component's configuration is also simpler and 
provides the fastest method to implement web services using Camel and 
CXF.</p></div></div><div class="confluence-information-macro 
confluence-information-macro-tip"><span class="aui-icon aui-icon-small 
aui-iconfont-approve confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>When using CXF in streaming modes 
(see DataFormat option), then also read about <a shape="rect" 
href="stream-caching.html">Stream caching</a>.</p></div></div><p>The 
<strong>cxf:</strong> component provides integration with <a shape="rect" 
href="http://cxf.apache.org";>Apache CXF</a> for connecting to JAX-WS services 
hosted in CXF.</p><p><style type="text/css">/*<![CDATA[*/
-div.rbtoc1489396737020 {padding: 0px;}
-div.rbtoc1489396737020 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1489396737020 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1489490263343 {padding: 0px;}
+div.rbtoc1489490263343 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1489490263343 li {margin-left: 0px;padding-left: 0px;}
 
-/*]]>*/</style></p><div class="toc-macro rbtoc1489396737020">
+/*]]>*/</style></p><div class="toc-macro rbtoc1489490263343">
 <ul class="toc-indentation"><li><a shape="rect" 
href="#BookComponentAppendix-CXFComponent">CXF Component</a>
 <ul class="toc-indentation"><li><a shape="rect" 
href="#BookComponentAppendix-URIformat">URI format</a></li><li><a shape="rect" 
href="#BookComponentAppendix-Options">Options</a>
 <ul class="toc-indentation"><li><a shape="rect" 
href="#BookComponentAppendix-Thedescriptionsofthedataformats">The descriptions 
of the dataformats</a>
@@ -4603,15 +4594,7 @@ $ java -jar camel-jasypt-2.5.0.jar -c de
 </div></div><p>Which outputs the following result:</p><div class="code panel 
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[Decrypted text: tiger
 ]]></script>
-</div></div><p>The idea is then to use those encrypted values in your <a 
shape="rect" href="properties.html">Properties</a> files. Notice how the 
password value is encrypted and the value has the tokens surrounding 
<code>ENC(value here)</code></p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
-# refer to a mock endpoint name by that encrypted password
-cool.result=mock:{{cool.password}}
-
-# here is a password which is encrypted
-cool.password=ENC(bsW9uV37gQ0QHFu7KO03Ww==)
-]]></script>
-</div></div><h4 
id="BookComponentAppendix-ToolingdependenciesforCamel2.5and2.6">Tooling 
dependencies for Camel 2.5 and 2.6</h4><p>The tooling requires the following 
JARs in the classpath, which has been enlisted in the <code>MANIFEST.MF</code> 
file of <code>camel-jasypt</code> with <code>optional/</code> as prefix. Hence 
why the java cmd above can pickup the needed JARs from the Apache Distribution 
in the <code>optional</code> directory.</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>The idea is then to use those encrypted values in your <a 
shape="rect" href="properties.html">Properties</a> files. Notice how the 
password value is encrypted and the value has the tokens surrounding 
<code>ENC(value here)</code></p><div class="error"><span class="error">Error 
formatting macro: snippet: java.lang.IndexOutOfBoundsException: Index: 20, 
Size: 20</span> </div><h4 
id="BookComponentAppendix-ToolingdependenciesforCamel2.5and2.6">Tooling 
dependencies for Camel 2.5 and 2.6</h4><p>The tooling requires the following 
JARs in the classpath, which has been enlisted in the <code>MANIFEST.MF</code> 
file of <code>camel-jasypt</code> with <code>optional/</code> as prefix. Hence 
why the java cmd above can pickup the needed JARs from the Apache Distribution 
in the <code>optional</code> directory.</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[jasypt-1.6.jar commons-lang-2.4.jar 
commons-codec-1.4.jar icu4j-4.0.1.jar
 ]]></script>
 </div></div><div class="confluence-information-macro 
confluence-information-macro-information"><p class="title">Java 1.5 
users</p><span class="aui-icon aui-icon-small aui-iconfont-info 
confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>The <code>icu4j-4.0.1.jar</code> 
is only needed when running on JDK 1.5.</p><p>This JAR is not distributed by 
Apache Camel and you have to download it manually and copy it to the 
<code>lib/optional</code> directory of the Camel distribution.<br clear="none"> 
You can download it from <a shape="rect" class="external-link" 
href="http://repo2.maven.org/maven2/com/ibm/icu/icu4j/4.0.1/"; 
rel="nofollow">Apache Central Maven repo</a>.</p></div></div><h4 
id="BookComponentAppendix-ToolingdependenciesforCamel2.7orbetter">Tooling 
dependencies for Camel 2.7 or better</h4><p>Jasypt 1.7 onwards is now fully 
standalone so no additional JARs is needed.</p><h3 
id="BookComponentAppendix-URIOptions.5">URI Options</h3><p>The options
  below are exclusive for the <a shape="rect" href="jasypt.html">Jasypt</a> 
component.</p><div class="confluenceTableSmall">
@@ -5036,13 +5019,7 @@ We store big input streams (by default,
      .setBody(&quot;select * from projects where license = :?lic and id &gt; 
:?min order by id&quot;)
      .to(&quot;jdbc:myDataSource?useHeadersAsParameters=true&quot;)
 ]]></script>
-</div></div><p>You can also store the header values in a 
<code>java.util.Map</code> and store the map on the headers with the key 
<code>CamelJdbcParameters</code>.</p><h3 
id="BookComponentAppendix-Samples.5">Samples</h3><p>In the following example, 
we fetch the rows from the customer table.</p><p>First we register our 
datasource in the Camel registry as <code>testdb</code>:</p><div class="code 
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
-JndiRegistry reg = super.createRegistry();
-reg.bind(&quot;testdb&quot;, db);
-return reg;
-]]></script>
-</div></div>Then we configure a route that routes to the JDBC component, so 
the SQL will be executed. Note how we refer to the <code>testdb</code> 
datasource that was bound in the previous step:<div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>You can also store the header values in a 
<code>java.util.Map</code> and store the map on the headers with the key 
<code>CamelJdbcParameters</code>.</p><h3 
id="BookComponentAppendix-Samples.5">Samples</h3><p>In the following example, 
we fetch the rows from the customer table.</p><p>First we register our 
datasource in the Camel registry as <code>testdb</code>:</p><div 
class="error"><span class="error">Error formatting macro: snippet: 
java.lang.IndexOutOfBoundsException: Index: 20, Size: 20</span> </div>Then we 
configure a route that routes to the JDBC component, so the SQL will be 
executed. Note how we refer to the <code>testdb</code> datasource that was 
bound in the previous step:<div class="code panel pdl" style="border-width: 
1px;"><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
 // lets add simple route
 public void configure() throws Exception {
@@ -5862,10 +5839,10 @@ monitor.start();
     &lt;!-- use the same version as your Camel core version --&gt;
 &lt;/dependency&gt;
 ]]></script>
-</div></div><p>Sending to the endpoint</p><p>You can store a Java entity bean 
in a database by sending it to a JPA producer endpoint. The body of the 
<em>In</em> message is assumed to be an entity bean (that is, a POJO with an <a 
shape="rect" class="external-link" 
href="http://java.sun.com/javaee/5/docs/api/javax/persistence/Entity.html"; 
rel="nofollow">@Entity</a> annotation on it) or a collection or array of entity 
beans.</p><p>If the body is a List of entities, make sure to use 
<strong>entityType=java.util.ArrayList</strong> as a configuration passed to 
the producer endpoint.</p><p>If the body does not contain one of the previous 
listed types, put a <a shape="rect" href="message-translator.html">Message 
Translator</a> in front of the endpoint to perform the necessary conversion 
first.</p><h3 id="BookComponentAppendix-Consumingfromtheendpoint.2">Consuming 
from the endpoint</h3><p>Consuming messages from a JPA consumer endpoint 
removes (or updates) entity beans in the database. This
  allows you to use a database table as a logical queue: consumers take 
messages from the queue and then delete/update them to logically remove them 
from the queue.</p><p>If you do not wish to delete the entity bean when it has 
been processed (and when routing is done), you can specify 
<code>consumeDelete=false</code> on the URI. This will result in the entity 
being processed each poll.</p><p>If you would rather perform some update on the 
entity to mark it as processed (such as to exclude it from a future query) then 
you can annotate a method with <a shape="rect" class="external-link" 
href="http://camel.apache.org/maven/current/camel-jpa/apidocs/org/apache/camel/component/jpa/Consumed.html";>@Consumed</a>
 which will be invoked on your entity bean when the entity bean when it has 
been processed (and when routing is done).</p><p>From <strong>Camel 
2.13</strong> onwards you can use <a shape="rect" class="external-link" 
href="http://camel.apache.org/maven/current/camel-jpa/apidocs/org/apa
 che/camel/component/jpa/PreConsumed.html">@PreConsumed</a> which will be 
invoked on your entity bean before it has been processed (before 
routing).</p><p>If you are consuming a lot (100K+) of rows and experience 
OutOfMemory problems you should set the maximumResults to sensible 
value.</p><p><strong>Note:</strong> Since <strong>Camel 2.18</strong>, JPA now 
includes a <code>JpaPollingConsumer</code> implementation that better supports 
Content Enricher using <code>pollEnrich()</code> to do an on-demand poll that 
returns either none, one or a list of entities as the result.</p><h3 
id="BookComponentAppendix-URIformat.33">URI format</h3><div class="code panel 
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>Sending to the endpoint</p><p>You can store a Java entity bean 
in a database by sending it to a JPA producer endpoint. The body of the 
<em>In</em> message is assumed to be an entity bean (that is, a POJO with an <a 
shape="rect" class="external-link" 
href="http://java.sun.com/javaee/5/docs/api/javax/persistence/Entity.html"; 
rel="nofollow">@Entity</a> annotation on it) or a collection or array of entity 
beans.</p><p>If the body is a List of entities, make sure to use 
<strong>entityType=java.util.ArrayList</strong> as a configuration passed to 
the producer endpoint.</p><p>If the body does not contain one of the previous 
listed types, put a <a shape="rect" href="message-translator.html">Message 
Translator</a> in front of the endpoint to perform the necessary conversion 
first.</p><p>From&#160;<strong>Camel 2.19</strong>&#160;onwards you can use 
<strong>query</strong>, <strong>namedQuery</strong> and 
<strong>nativeQuery&#160;</strong>option for the producer as well to retri
 eve a set of entities or execute bulk update/delete.</p><h3 
id="BookComponentAppendix-Consumingfromtheendpoint.2">Consuming from the 
endpoint</h3><p>Consuming messages from a JPA consumer endpoint removes (or 
updates) entity beans in the database. This allows you to use a database table 
as a logical queue: consumers take messages from the queue and then 
delete/update them to logically remove them from the queue.</p><p>If you do not 
wish to delete the entity bean when it has been processed (and when routing is 
done), you can specify <code>consumeDelete=false</code> on the URI. This will 
result in the entity being processed each poll.</p><p>If you would rather 
perform some update on the entity to mark it as processed (such as to exclude 
it from a future query) then you can annotate a method with <a shape="rect" 
class="external-link" 
href="http://camel.apache.org/maven/current/camel-jpa/apidocs/org/apache/camel/component/jpa/Consumed.html";>@Consumed</a>
 which will be invoked on your en
 tity bean when the entity bean when it has been processed (and when routing is 
done).</p><p>From <strong>Camel 2.13</strong> onwards you can use <a 
shape="rect" class="external-link" 
href="http://camel.apache.org/maven/current/camel-jpa/apidocs/org/apache/camel/component/jpa/PreConsumed.html";>@PreConsumed</a>
 which will be invoked on your entity bean before it has been processed (before 
routing).</p><p>If you are consuming a lot (100K+) of rows and experience 
OutOfMemory problems you should set the maximumResults to sensible 
value.</p><p><strong>Note:</strong> Since <strong>Camel 2.18</strong>, JPA now 
includes a <code>JpaPollingConsumer</code> implementation that better supports 
Content Enricher using <code>pollEnrich()</code> to do an on-demand poll that 
returns either none, one or a list of entities as the 
result.</p><p>&#160;</p><h3 id="BookComponentAppendix-URIformat.33">URI 
format</h3><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent p
 dl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[jpa:entityClassName[?options]
 ]]></script>
-</div></div><p>For sending to the endpoint, the <em>entityClassName</em> is 
optional. If specified, it helps the <a shape="rect" 
href="type-converter.html">Type Converter</a> to ensure the body is of the 
correct type.</p><p>For consuming, the <em>entityClassName</em> is 
mandatory.</p><p>You can append query options to the URI in the following 
format, <code>?option=value&amp;option=value&amp;...</code></p><h3 
id="BookComponentAppendix-Options.28">Options</h3><div 
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Default Value</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>entityType</code></p></td><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><em>entityClassName</em></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Overrides the <em>entityClas
 sName</em> from the URI.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>persistenceUnit</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>camel</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>The JPA persistence unit used by 
default.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>consumeDelete</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>JPA consumer only:</strong> If 
<code>true</code>, the entity is deleted after it is consumed; if 
<code>false</code>, the entity is not deleted.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>consumeLockEntity</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>JPA consumer 
only:</strong> Specifies whether or not to set a
 n exclusive lock on each entity bean while processing the results from 
polling.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>flushOnSend</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>JPA producer only:</strong> Flushes 
the <a shape="rect" class="external-link" 
href="http://java.sun.com/javaee/5/docs/api/javax/persistence/EntityManager.html";
 rel="nofollow">EntityManager</a> after the entity bean has been 
persisted.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>maximumResults</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>-1</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>JPA consumer only:</strong> Set the 
maximum number of results to retrieve on the <a shape="rect" 
class="external-link" 
href="http://java.sun.com/javaee/5/docs/api/javax/persistence/Query.html"; 
rel="nof
 ollow">Query</a>.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>transactionManager</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>This option is <a shape="rect" 
href="registry.html">Registry</a> based which requires the <code>#</code> 
notation so that the given <code>transactionManager</code> being specified can 
be looked up properly, e.g. 
<code>transactionManager=#myTransactionManager</code>. It specifies the 
transaction manager to use. If none provided, Camel will use a 
<code>JpaTransactionManager</code> by default. Can be used to set a JTA 
transaction manager (for integration with an EJB 
container).</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>consumer.delay</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>500</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>JPA consumer only:
 </strong> Delay in milliseconds between each poll.</p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>consumer.initialDelay</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>1000</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>JPA consumer 
only:</strong> Milliseconds before polling starts.</p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>consumer.useFixedDelay</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>JPA consumer 
only:</strong> Set to <code>true</code> to use fixed delay between polls, 
otherwise fixed rate is used. See <a shape="rect" class="external-link" 
href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/ScheduledExecutorService.html";
 rel="nofollow">ScheduledExecutorService</a> in JDK for 
details.</p></td></tr><tr><td colspan="1" rowspan="1" class="conflue
 nceTd"><p><code>maxMessagesPerPoll</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>0</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><strong>JPA consumer only:</strong> An integer value to 
define the maximum number of messages to gather per poll. By default, no 
maximum is set. Can be used to avoid polling many thousands of messages when 
starting up the server. Set a value of 0 or negative to 
disable.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>consumer.query</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><strong>JPA consumer only:</strong> To use a custom 
query when consuming data.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>consumer.namedQuery</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>JPA consu
 mer only:</strong> To use a named query when consuming 
data.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>consumer.nativeQuery</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>JPA consumer only:</strong> To use 
a custom native query when consuming data. You may want to use the option 
<code>consumer.resultClass</code> also when using native 
queries.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>consumer.parameters</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>Camel 2.12: JPA consumer 
only:</strong> This option is <a shape="rect" href="registry.html">Registry</a> 
based which requires the <code>#</code> notation. This key/value mapping is 
used for building the query parameters. It's is expected to be of the generic 
type <code>java.util.Map&lt
 ;String, Object&gt;</code> where the keys are the named parameters of a given 
JPA query and the values are their corresponding effective values you want to 
select for.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>consumer.resultClass</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>Camel 2.7: JPA consumer 
only:</strong> Defines the type of the returned payload (we will call 
<code>entityManager.createNativeQuery(nativeQuery, resultClass)</code> instead 
of <code>entityManager.createNativeQuery(nativeQuery)</code>). Without this 
option, we will return an object array. Only has an affect when using in 
conjunction with native query when consuming data.</p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>consumer.transacted</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td 
colspan="1" rowspan="1" c
 lass="confluenceTd"><p><strong>Camel 2.7.5/2.8.3/2.9: JPA consumer 
only:</strong> Whether to run the consumer in transacted mode, by which all 
messages will either commit or rollback, when the entire batch has been 
processed. The default behavior (false) is to commit all the previously 
successfully processed messages, and only rollback the last failed 
message.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>consumer.lockModeType</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>WRITE</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 
2.11.2/2.12:</strong> To configure the lock mode on the consumer. The possible 
values is defined in the enum <code>javax.persistence.LockModeType</code>. The 
default value is changed to <code>PESSIMISTIC_WRITE</code> since <strong>Camel 
2.13</strong>.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>consumer.SkipLockedEntity</code></p></td><td colsp
 an="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.13:</strong> To 
configure whether to use NOWAIT on lock and silently skip the 
entity.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>usePersist</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>Camel 2.5: JPA producer 
only:</strong> Indicates to use <code>entityManager.persist(entity)</code> 
instead of <code>entityManager.merge(entity)</code>. Note: 
<code>entityManager.persist(entity)</code> doesn't work for detached entities 
(where the EntityManager has to execute an UPDATE instead of an INSERT 
query)!</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>joinTransaction</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" 
rowspan="1" class=
 "confluenceTd"><p><strong>Camel 2.12.3:</strong> camel-jpa will join 
transaction by default from Camel 2.12 onwards. You can use this option to turn 
this off, for example if you use LOCAL_RESOURCE and join transaction doesn't 
work with your JPA provider. This option can also be set globally on the 
<code>JpaComponent</code>, instead of having to set it on all 
endpoints.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p 
class="p1">usePassedInEntityManager</p></td><td colspan="1" rowspan="1" 
class="confluenceTd">false</td><td colspan="1" rowspan="1" 
class="confluenceTd"><strong>Camel 2.12.4/2.13.1 JPA producer only:</strong> If 
set to true, then Camel will use the EntityManager from the header<p 
class="p1">JpaConstants.ENTITYMANAGER instead of the configured entity manager 
on the component/endpoint. This allows end users to control which entity 
manager will be in use.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd">sharedEntityManager</td><td colspa
 n="1" rowspan="1" class="confluenceTd">false</td><td colspan="1" rowspan="1" 
class="confluenceTd"><strong>Camel 2.16:</strong>&#160;whether to use spring's 
SharedEntityManager for the consumer/producer. A good idea may be to set 
joinTransaction=false if this option is true, as sharing the entity manager and 
mixing transactions is not a good idea.</td></tr></tbody></table></div><h3 
id="BookComponentAppendix-MessageHeaders.10">Message Headers</h3><p>Camel adds 
the following message headers to the exchange:</p><div 
class="confluenceTableSmall"><div class="table-wrap"><table 
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Header</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Type</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>CamelJpaTemplate</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>JpaTemplate</code></p><
 /td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Not supported 
anymore since Camel 2.12:</strong> The <code>JpaTemplate</code> object that is 
used to access the entity bean. You need this object in some situations, for 
instance in a type converter or when you are doing some custom processing. See 
<a shape="rect" class="external-link" 
href="https://issues.apache.org/jira/browse/CAMEL-5932";>CAMEL-5932</a> for the 
reason why the support for this header has been dropped.</p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>CamelEntityManager</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>EntityManager</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.12: JPA 
consumer / Camel 2.12.2: JPA producer:</strong> The JPA 
<code>EntityManager</code> object being used by <code>JpaConsumer</code> or 
<code>JpaProducer</code>.</p></td></tr></tbody></table></div></div>
+</div></div><p>For sending to the endpoint, the <em>entityClassName</em> is 
optional. If specified, it helps the <a shape="rect" 
href="type-converter.html">Type Converter</a> to ensure the body is of the 
correct type.</p><p>For consuming, the <em>entityClassName</em> is 
mandatory.</p><p>You can append query options to the URI in the following 
format, <code>?option=value&amp;option=value&amp;...</code></p><h3 
id="BookComponentAppendix-Options.28">Options</h3><div 
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Default Value</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>entityType</code></p></td><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><em>entityClassName</em></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Overrides the <em>entityClas
 sName</em> from the URI.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>persistenceUnit</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>camel</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>The JPA persistence unit used by 
default.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>consumeDelete</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>JPA consumer only:</strong> If 
<code>true</code>, the entity is deleted after it is consumed; if 
<code>false</code>, the entity is not deleted.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>consumeLockEntity</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>JPA consumer 
only:</strong> Specifies whether or not to set a
 n exclusive lock on each entity bean while processing the results from 
polling.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>flushOnSend</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>JPA producer only:</strong> Flushes 
the <a shape="rect" class="external-link" 
href="http://java.sun.com/javaee/5/docs/api/javax/persistence/EntityManager.html";
 rel="nofollow">EntityManager</a> after the entity bean has been 
persisted.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>maximumResults</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>-1</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>JPA consumer only:</strong> Set the 
maximum number of results to retrieve on the <a shape="rect" 
class="external-link" 
href="http://java.sun.com/javaee/5/docs/api/javax/persistence/Query.html"; 
rel="nof
 ollow">Query</a>. <strong>Camel 2.19:</strong><span> it's also used for the 
producer when it executes a query.</span></p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>transactionManager</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>This option is <a shape="rect" 
href="registry.html">Registry</a> based which requires the <code>#</code> 
notation so that the given <code>transactionManager</code> being specified can 
be looked up properly, e.g. 
<code>transactionManager=#myTransactionManager</code>. It specifies the 
transaction manager to use. If none provided, Camel will use a 
<code>JpaTransactionManager</code> by default. Can be used to set a JTA 
transaction manager (for integration with an EJB 
container).</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>consumer.delay</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><co
 de>500</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><strong>JPA consumer only:</strong> Delay in 
milliseconds between each poll.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>consumer.initialDelay</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>1000</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>JPA consumer 
only:</strong> Milliseconds before polling starts.</p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>consumer.useFixedDelay</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>JPA consumer 
only:</strong> Set to <code>true</code> to use fixed delay between polls, 
otherwise fixed rate is used. See <a shape="rect" class="external-link" 
href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/ScheduledExecutorService.html";
 rel="nofollow">Schedule
 dExecutorService</a> in JDK for details.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>maxMessagesPerPoll</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>0</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>JPA consumer 
only:</strong> An integer value to define the maximum number of messages to 
gather per poll. By default, no maximum is set. Can be used to avoid polling 
many thousands of messages when starting up the server. Set a value of 0 or 
negative to disable.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>consumer.query</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><strong>JPA consumer only:</strong> To use a custom 
query when consuming data.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>consumer.namedQuery</code></p></td><td 
colspan="1" rowspan="1" class="c
 onfluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><strong>JPA consumer only:</strong> To use a named 
query when consuming data.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>consumer.nativeQuery</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>JPA consumer only:</strong> To use 
a custom native query when consuming data. You may want to use the option 
<code>consumer.resultClass</code> also when using native 
queries.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>consumer.parameters</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>Camel 2.12: JPA consumer 
only:</strong> This option is <a shape="rect" href="registry.html">Registry</a> 
based which requires the <code>#</code> notation. This key/value mapping is 
used 
 for building the query parameters. It's is expected to be of the generic type 
<code>java.util.Map&lt;String, Object&gt;</code> where the keys are the named 
parameters of a given JPA query and the values are their corresponding 
effective values you want to select for.</p></td></tr><tr><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>consumer.resultClass</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>Camel 2.7: JPA consumer 
only:</strong> Defines the type of the returned payload (we will call 
<code>entityManager.createNativeQuery(nativeQuery, resultClass)</code> instead 
of <code>entityManager.createNativeQuery(nativeQuery)</code>). Without this 
option, we will return an object array. Only has an affect when using in 
conjunction with native query when consuming data.</p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>consumer.transacted</code></p></td><td cols
 pan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.7.5/2.8.3/2.9: 
JPA consumer only:</strong> Whether to run the consumer in transacted mode, by 
which all messages will either commit or rollback, when the entire batch has 
been processed. The default behavior (false) is to commit all the previously 
successfully processed messages, and only rollback the last failed 
message.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>consumer.lockModeType</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>WRITE</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 
2.11.2/2.12:</strong> To configure the lock mode on the consumer. The possible 
values is defined in the enum <code>javax.persistence.LockModeType</code>. The 
default value is changed to <code>PESSIMISTIC_WRITE</code> since <strong>Camel 
2.13</strong>.</p></td></tr><tr><td cols
 pan="1" rowspan="1" 
class="confluenceTd"><p><code>consumer.SkipLockedEntity</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.13:</strong> To 
configure whether to use NOWAIT on lock and silently skip the 
entity.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>usePersist</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>Camel 2.5: JPA producer 
only:</strong> Indicates to use <code>entityManager.persist(entity)</code> 
instead of <code>entityManager.merge(entity)</code>. Note: 
<code>entityManager.persist(entity)</code> doesn't work for detached entities 
(where the EntityManager has to execute an UPDATE instead of an INSERT 
query)!</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>joinTransaction</code></p></td><td colspan=
 "1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.12.3:</strong> 
camel-jpa will join transaction by default from Camel 2.12 onwards. You can use 
this option to turn this off, for example if you use LOCAL_RESOURCE and join 
transaction doesn't work with your JPA provider. This option can also be set 
globally on the <code>JpaComponent</code>, instead of having to set it on all 
endpoints.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p 
class="p1">usePassedInEntityManager</p></td><td colspan="1" rowspan="1" 
class="confluenceTd">false</td><td colspan="1" rowspan="1" 
class="confluenceTd"><strong>Camel 2.12.4/2.13.1 JPA producer only:</strong> If 
set to true, then Camel will use the EntityManager from the header<p 
class="p1">JpaConstants.ENTITYMANAGER instead of the configured entity manager 
on the component/endpoint. This allows end users to control which entity 
manager will be in use.<
 /p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd">sharedEntityManager</td><td colspan="1" rowspan="1" 
class="confluenceTd">false</td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><strong>Camel 2.16:</strong>&#160;whether to use 
spring's SharedEntityManager for the consumer/producer. A good idea may be to 
set joinTransaction=false if this option is true, as sharing the entity manager 
and mixing transactions is not a good idea.&#160;</p></td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><span>query</span></td><td 
colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" 
rowspan="1" class="confluenceTd"><span>To use a custom query. <strong>Camel 
2.19:</strong> it can be used for producer as well.</span></td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd">namedQuery</td><td colspan="1" 
rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" 
class="confluenceTd"><span>To use a named query. <strong>Camel 2.19:</stro
 ng> it can be used for producer as well.</span></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd">nativeQuery</td><td colspan="1" rowspan="1" 
class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" 
class="confluenceTd">To use a custom native query. <span>You may want to use 
the option </span><code>resultClass</code><span> also when using native 
queries. <strong>Camel 2.19:</strong><span> it can be used for producer as 
well.</span></span></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd">parameters</td><td colspan="1" rowspan="1" 
class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" 
class="confluenceTd"><span>This option is </span><a shape="rect" 
href="registry.html">Registry</a><span> based which requires the 
</span><code>#</code><span> notation. This key/value mapping is used for 
building the query parameters. It is expected to be of the generic type 
</span><code>java.util.Map&lt;String, Object&gt;</code><span> where the keys 
are the named paramete
 rs of a given JPA query and the values are their corresponding effective 
values you want to select for. <strong>Camel 2.19:</strong><span> it can be 
used for producer as well. When it's used for producer, <a shape="rect" 
href="simple.html">Simple</a> expression can be used as a parameter value. It 
allows you to retrieve parameter values from the message body header and 
etc.</span></span></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd">resultClass</td><td colspan="1" rowspan="1" 
class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" 
class="confluenceTd"><span>Defines the type of the returned payload (we will 
call </span><code>entityManager.createNativeQuery(nativeQuery, 
resultClass)</code><span> instead of 
</span><code>entityManager.createNativeQuery(nativeQuery)</code><span>). 
Without this option, we will return an object array. Only has an affect when 
using in conjunction with native query. <strong>Camel 2.19:</strong><span> it 
can be used for producer as well.</
 span></span></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd">useExecuteUpdate</td><td colspan="1" rowspan="1" 
class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" 
class="confluenceTd"><strong>Camel 2.19: JPA producer only:</strong><span> To 
configure whether to use executeUpdate() when producer executes a query. When 
you use INSERT, UPDATE or DELETE statement as a named query, you need to 
specify this option to 'true'.</span></td></tr></tbody></table></div><h3 
id="BookComponentAppendix-MessageHeaders.10">Message Headers</h3><p>Camel adds 
the following message headers to the exchange:</p><div 
class="confluenceTableSmall"><div class="table-wrap"><table 
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Header</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Type</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>CamelJpaTem
 plate</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>JpaTemplate</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>Not supported anymore since Camel 
2.12:</strong> The <code>JpaTemplate</code> object that is used to access the 
entity bean. You need this object in some situations, for instance in a type 
converter or when you are doing some custom processing. See <a shape="rect" 
class="external-link" 
href="https://issues.apache.org/jira/browse/CAMEL-5932";>CAMEL-5932</a> for the 
reason why the support for this header has been dropped.</p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>CamelEntityManager</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>EntityManager</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.12: JPA 
consumer / Camel 2.12.2: JPA producer:</strong> The JPA 
<code>EntityManager</code> object being used by <code>JpaConsumer</code> or <cod
 e>JpaProducer</code>.</p></td></tr></tbody></table></div></div>
 
 
 <h3 id="BookComponentAppendix-ConfiguringEntityManagerFactory">Configuring 
EntityManagerFactory</h3><p>Its strongly advised to configure the JPA component 
to use a specific <code>EntityManagerFactory</code> instance. If failed to do 
so each <code>JpaEndpoint</code> will auto create their own instance of 
<code>EntityManagerFactory</code> which most often is not what you 
want.</p><p>For example, you can instantiate a JPA component that references 
the <code>myEMFactory</code> entity manager factory, as follows:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
@@ -5898,7 +5875,26 @@ public class MultiSteps {
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[from(&quot;jpa://org.apache.camel.examples.MultiSteps?consumer.nativeQuery=select
 * from MultiSteps where step = 1&quot;)
 .to(&quot;bean:myBusinessLogic&quot;);
 ]]></script>
-</div></div><p>If you use the native query option, you will receive an object 
array in the message body.</p><h3 
id="BookComponentAppendix-Example.6">Example</h3><p>See <a shape="rect" 
href="tracer-example.html">Tracer Example</a> for an example using <a 
shape="rect" href="jpa.html">JPA</a> to store traced messages into a 
database.</p><h3 
id="BookComponentAppendix-UsingtheJPAbasedidempotentrepository">Using the JPA 
based idempotent repository</h3><p>In this section we will use the JPA based 
idempotent repository.</p><p>First we need to setup a 
<code>persistence-unit</code> in the persistence.xml file:</p><div class="code 
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>If you use the native query option, you will receive an object 
array in the message body.</p><p>&#160;</p><h3 
id="BookComponentAppendix-Usingaproducerwithanamedquery">Using a producer with 
a named query</h3><p>For retrieving selected entities or execute bulk 
update/delete, you can use the&#160;<code>namedQuery</code>&#160;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="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[@Entity
+@NamedQuery(name = &quot;step1&quot;, query = &quot;select x from MultiSteps x 
where x.step = 1&quot;)
+public class MultiSteps {
+   ...
+}
+]]></script>
+</div></div><p>After that you can define a producer uri like this one:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[from(&quot;direct:namedQuery&quot;)
+.to(&quot;jpa://org.apache.camel.examples.MultiSteps?namedQuery=step1&quot;);
+]]></script>
+</div></div><h3 id="BookComponentAppendix-Usingaproducerwithaquery">Using a 
producer with a query</h3><p>For retrieving selected entities or execute bulk 
update/delete, you can use the&#160;<code>query</code>&#160;URI query option. 
You only have to define the query option:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[from(&quot;direct:query&quot;)
+.to(&quot;jpa://org.apache.camel.examples.MultiSteps?query=select o from 
org.apache.camel.examples.MultiSteps o where o.step = 1&quot;);
+]]></script>
+</div></div><h3 
id="BookComponentAppendix-Usingaproducerwithanativequery">Using a producer with 
a native query</h3><p>For retrieving selected entities or execute bulk 
update/delete, you can use the&#160;<code>nativeQuery</code>&#160;URI query 
option. You only have to define the native query option:</p><div class="code 
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[from(&quot;direct:nativeQuery&quot;)
+.to(&quot;jpa://org.apache.camel.examples.MultiSteps?resultClass=org.apache.camel.examples.MultiSteps&amp;nativeQuery=select
 * from MultiSteps where step = 1&quot;);
+]]></script>
+</div></div><p>If you use the native query option without specifying 
<em>resultClass</em>, you will receive an object array in the message 
body.</p><p>&#160;</p><h3 
id="BookComponentAppendix-Example.6">Example</h3><p>See <a shape="rect" 
href="tracer-example.html">Tracer Example</a> for an example using <a 
shape="rect" href="jpa.html">JPA</a> to store traced messages into a 
database.</p><h3 
id="BookComponentAppendix-UsingtheJPAbasedidempotentrepository">Using the JPA 
based idempotent repository</h3><p>In this section we will use the JPA based 
idempotent repository.</p><p>First we need to setup a 
<code>persistence-unit</code> in the persistence.xml file:</p><div class="code 
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
 &lt;persistence-unit name=&quot;idempotentDb&quot; 
transaction-type=&quot;RESOURCE_LOCAL&quot;&gt;
   
&lt;class&gt;org.apache.camel.processor.idempotent.jpa.MessageProcessed&lt;/class&gt;


Reply via email to