camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r898513 - in /websites/production/camel/content: cache/main.pageCache jpa.html
Date Wed, 19 Feb 2014 14:19:21 GMT
Author: buildbot
Date: Wed Feb 19 14:19:21 2014
New Revision: 898513

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 Wed Feb 19 14:19:21 2014
@@ -86,140 +86,51 @@
 	<tbody>
         <tr>
         <td valign="top" width="100%">
-<div class="wiki-content maincontent"><h2 id="JPA-JPAComponent">JPA Component</h2>
-
-<p>The <strong>jpa</strong> component enables you to store and retrieve Java objects from persistent storage using EJB 3's Java Persistence Architecture (JPA), which is a standard interface layer that wraps Object/Relational Mapping (ORM) products such as OpenJPA, Hibernate, TopLink, and so on.</p>
-
-<p>Maven users will need to add the following dependency to their <code>pom.xml</code> for this component:</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;dependency&gt;
+<div class="wiki-content maincontent"><h2 id="JPA-JPAComponent">JPA Component</h2><p>The <strong>jpa</strong> component enables you to store and retrieve Java objects from persistent storage using EJB 3's Java Persistence Architecture (JPA), which is a standard interface layer that wraps Object/Relational Mapping (ORM) products such as OpenJPA, Hibernate, TopLink, and so on.</p><p>Maven users will need to add the following dependency to their <code>pom.xml</code> for this component:</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;dependency&gt;
     &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
     &lt;artifactId&gt;camel-jpa&lt;/artifactId&gt;
     &lt;version&gt;x.x.x&lt;/version&gt;
     &lt;!-- use the same version as your Camel core version --&gt;
 &lt;/dependency&gt;
 ]]></script>
-</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 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/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]
+</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="confluenceTableSmall">
-<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 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 an 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/per
 sistence/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" title="Registry">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="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 th
 e 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" title="Registry">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>. </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></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></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><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 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 an 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="nofoll
 ow">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" title="Registry">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="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="confluenceTd"><p>&#160;</p></td><td colspan="1" ro
 wspan="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" title="Registry">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" 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></tbody></table>
+<h3 id="JPA-MessageHeaders">Message Headers</h3><p>Camel adds the following message headers to the exchange:</p><div class="confluenceTableSmall">
 <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>
-
-<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;
+</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;
 ]]></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">
-<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;
+</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">
+<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;property name=&quot;transactionManager&quot; ref=&quot;myTransactionManager&quot;/&gt;
 &lt;/bean&gt;
 ]]></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">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-@Entity
+</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">
+<script class="theme: Default; brush: java; gutter: false" 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 consumer uri like this one:</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[
-from(&quot;jpa://org.apache.camel.examples.MultiSteps?consumer.namedQuery=step1&quot;)
+</div></div><p>After that you can define a consumer uri like this one:</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[from(&quot;jpa://org.apache.camel.examples.MultiSteps?consumer.namedQuery=step1&quot;)
 .to(&quot;bean:myBusinessLogic&quot;);
 ]]></script>
-</div></div>
-
-<h3 id="JPA-Usingaconsumerwithaquery">Using a consumer with a query</h3>
-<p>For consuming only selected entities, you can use the <code>consumer.query</code> 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="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-from(&quot;jpa://org.apache.camel.examples.MultiSteps?consumer.query=select o from org.apache.camel.examples.MultiSteps o where o.step = 1&quot;)
+</div></div><h3 id="JPA-Usingaconsumerwithaquery">Using a consumer with a query</h3><p>For consuming only selected entities, you can use the <code>consumer.query</code> 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="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[from(&quot;jpa://org.apache.camel.examples.MultiSteps?consumer.query=select o from org.apache.camel.examples.MultiSteps o where o.step = 1&quot;)
 .to(&quot;bean:myBusinessLogic&quot;);
 ]]></script>
-</div></div>
-
-<h3 id="JPA-Usingaconsumerwithanativequery">Using a consumer with a native query</h3>
-<p>For consuming only selected entities, you can use the <code>consumer.nativeQuery</code> 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="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-from(&quot;jpa://org.apache.camel.examples.MultiSteps?consumer.nativeQuery=select * from MultiSteps where step = 1&quot;)
+</div></div><h3 id="JPA-Usingaconsumerwithanativequery">Using a consumer with a native query</h3><p>For consuming only selected entities, you can use the <code>consumer.nativeQuery</code> 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="theme: Default; brush: java; gutter: false" 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="JPA-Example">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="JPA-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><h3 id="JPA-Example">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="JPA-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="theme: Default; brush: xml; gutter: false" 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;
@@ -232,10 +143,7 @@ from(&quot;jpa://org.apache.camel.exampl
   &lt;/properties&gt;
 &lt;/persistence-unit&gt;
 ]]></script>
-</div></div>
-
-<p>Second we have to setup a <code>org.springframework.orm.jpa.JpaTemplate</code> which is used by the <code>org.apache.camel.processor.idempotent.jpa.JpaMessageIdRepository</code>:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>Second we have to setup a <code>org.springframework.orm.jpa.JpaTemplate</code> which is used by the <code>org.apache.camel.processor.idempotent.jpa.JpaMessageIdRepository</code>:</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;!-- this is standard spring JPA configuration --&gt;
 &lt;bean id=&quot;jpaTemplate&quot; class=&quot;org.springframework.orm.jpa.JpaTemplate&quot;&gt;
@@ -247,10 +155,7 @@ from(&quot;jpa://org.apache.camel.exampl
     &lt;property name=&quot;persistenceUnitName&quot; value=&quot;idempotentDb&quot;/&gt;
 &lt;/bean&gt;
 ]]></script>
-</div></div>
-
-<p>Afterwards we can configure our <code>org.apache.camel.processor.idempotent.jpa.JpaMessageIdRepository</code>:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>Afterwards we can configure our <code>org.apache.camel.processor.idempotent.jpa.JpaMessageIdRepository</code>:</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;!-- we define our jpa based idempotent repository we want to use in the file consumer --&gt;
 &lt;bean id=&quot;jpaStore&quot; class=&quot;org.apache.camel.processor.idempotent.jpa.JpaMessageIdRepository&quot;&gt;
@@ -261,12 +166,8 @@ from(&quot;jpa://org.apache.camel.exampl
     &lt;constructor-arg index=&quot;1&quot; value=&quot;FileConsumer&quot;/&gt;
 &lt;/bean&gt;
 ]]></script>
-</div></div>
-
-<p>And finally we can create our JPA idempotent repository in the spring XML file as well:</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;camelContext xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;	
+</div></div><p>And finally we can create our JPA idempotent repository in the spring XML file as well:</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;camelContext xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;	
     &lt;route id=&quot;JpaMessageIdRepositoryTest&quot;&gt;
         &lt;from uri=&quot;direct:start&quot; /&gt;
         &lt;idempotentConsumer messageIdRepositoryRef=&quot;jpaStore&quot;&gt;
@@ -276,18 +177,12 @@ from(&quot;jpa://org.apache.camel.exampl
     &lt;/route&gt;
 &lt;/camelContext&gt;
 ]]></script>
-</div></div>
-
-    <div class="aui-message hint shadowed information-macro">
+</div></div>    <div class="aui-message hint shadowed information-macro">
                     <p class="title">When running this Camel component tests inside your IDE</p>
                             <span class="aui-icon icon-hint">Icon</span>
                 <div class="message-content">
-                            
-<p>In case you run the <a shape="rect" class="external-link" href="https://svn.apache.org/repos/asf/camel/trunk/components/camel-jpa/src/test">tests of this component</a> directly inside your IDE (and not necessarily through Maven itself) then you could spot exceptions like:</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[
-org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is
+                            <p>In case you run the <a shape="rect" class="external-link" href="https://svn.apache.org/repos/asf/camel/trunk/components/camel-jpa/src/test">tests of this component</a> directly inside your IDE (and not necessarily through Maven itself) then you could spot exceptions like:</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[org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is
 &lt;openjpa-2.2.1-r422266:1396819 nonfatal user error&gt; org.apache.openjpa.persistence.ArgumentException: This configuration disallows runtime optimization,
 but the following listed types were not enhanced at build time or at class load time with a javaagent: &quot;org.apache.camel.examples.SendEmail&quot;.
 	at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:427)
@@ -298,24 +193,15 @@ but the following listed types were not 
 	at org.apache.camel.test.junit4.CamelTestSupport.doSetUp(CamelTestSupport.java:238)
 	at org.apache.camel.test.junit4.CamelTestSupport.setUp(CamelTestSupport.java:208)
 ]]></script>
-</div></div>
-
-<p>The problem here is that the source has been compiled/recompiled through your IDE and not through Maven itself which would <a shape="rect" class="external-link" href="https://svn.apache.org/repos/asf/camel/trunk/components/camel-jpa/pom.xml">enhance the byte-code at build time</a>. To overcome this you would need to enable <a shape="rect" class="external-link" href="http://openjpa.apache.org/entity-enhancement.html#dynamic-enhancement">dynamic byte-code enhancement of OpenJPA</a>. As an example assuming the current OpenJPA version being used in Camel itself is 2.2.1, then as running the tests inside your favorite IDE you would need to pass the following argument to the JVM:</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>The problem here is that the source has been compiled/recompiled through your IDE and not through Maven itself which would <a shape="rect" class="external-link" href="https://svn.apache.org/repos/asf/camel/trunk/components/camel-jpa/pom.xml">enhance the byte-code at build time</a>. To overcome this you would need to enable <a shape="rect" class="external-link" href="http://openjpa.apache.org/entity-enhancement.html#dynamic-enhancement">dynamic byte-code enhancement of OpenJPA</a>. As an example assuming the current OpenJPA version being used in Camel itself is 2.2.1, then as running the tests inside your favorite IDE you would need to pass the following argument to the JVM:</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[ 
 -javaagent:&lt;path_to_your_local_m2_cache&gt;/org/apache/openjpa/openjpa/2.2.1/openjpa-2.2.1.jar
 ]]></script>
-</div></div> 
-
-<p>Then it will all become green again <img class="emoticon emoticon-smile" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/smile.png" data-emoticon-name="smile" alt="(smile)"></p>
+</div></div><p>Then it will all become green again <img class="emoticon emoticon-smile" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/smile.png" data-emoticon-name="smile" alt="(smile)"></p>
                     </div>
     </div>
-
-
-<h3 id="JPA-SeeAlso">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 class="alternate"><li><a shape="rect" href="tracer-example.html">Tracer Example</a></li></ul></div>
+<p></p><h3 id="JPA-SeeAlso">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 class="alternate"><li><a shape="rect" href="tracer-example.html">Tracer Example</a></li></ul></div>
         </td>
         <td valign="top">
           <div class="navigation">



Mime
View raw message