Modified: websites/production/camel/content/jpa.html
==============================================================================
--- websites/production/camel/content/jpa.html (original)
+++ websites/production/camel/content/jpa.html Tue Apr 14 15:19:57 2015
@@ -97,9 +97,7 @@
 </div></div><h3 id="JPA-Sendingtotheendpoint">Sending to the 
endpoint</h3><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 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="JPA-Consumingfromtheendpoint">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 the
 m 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/apache/camel/component/jpa/PreConsumed.html";>@PreConsumed</a>
 which will be invoked on your entity bean before it has been processed (before 
routing)
 .</p><h3 id="JPA-URIformat">URI format</h3><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[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="JPA-Options">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>entityClassName</em> from 
the U
 RI.</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 an exclusive lock on e
 ach 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="nofollow">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 mi
 lliseconds 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="confluenceTd"><p><code>maxMe
 ssagesPerPoll</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 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 
colspan="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 colspan="1" rowspan="1" 
class="confluenceTd"><p><code>consumer.SkipLockedEntity</code></p></td><td 
colspan="1" rowspan="1" cl
 ass="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><st
 rong>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></tbody></table></div><h3 
id="JPA-MessageHeaders">Message Headers</h3><p>Camel adds the following message 
he
 aders 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" cl
 ass="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><h3 id="JPA-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">
+</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="JPA-Options">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>entityClassName</em> from 
the U
 RI.</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 an exclusive lock on e
 ach 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="nofollow">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 mi
 lliseconds 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="confluenceTd"><p><code>maxMe
 ssagesPerPoll</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 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 
colspan="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 colspan="1" rowspan="1" 
class="confluenceTd"><p><code>consumer.SkipLockedEntity</code></p></td><td 
colspan="1" rowspan="1" cl
 ass="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><st
 rong>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" cla
 ss="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="JPA-MessageHeaders">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="con
 fluenceTd"><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><h3 
id="JPA-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">
 <script class="theme: Default; brush: xml; gutter: false" 
type="syntaxhighlighter"><![CDATA[&lt;bean id=&quot;jpa&quot; 
class=&quot;org.apache.camel.component.jpa.JpaComponent&quot;&gt;
    &lt;property name=&quot;entityManagerFactory&quot; 
ref=&quot;myEMFactory&quot;/&gt;
 &lt;/bean&gt;


Reply via email to