Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Improved section on JPA TransactionManager configuration.

...

Configuring TransactionManager

Since Camel 2.3 the JpaComponent will auto lookup the TransactionManager from the Registry. If Camel won't find any TransactionManager instance registered, it will also look up for the TransactionTemplate and try to extract TransactionManager from it.

If none TransactionTemplate is available in the registry, Its strongly advised to configure the TransactionManager instance used by the JPA component. If failed to do so each JpaEndpoint will auto create their own instance of TransactionManager which most often is not what you want.what you want.

If more than single instance of the TransactionManager is found, Camel will log a WARN. In such cases you might want to instantiate and explicitly configure For example, you can instantiate a JPA component that references the myTransactionManager transaction manager, as follows:

Code Block
xml
xml
<bean id="jpa" class="org.apache.camel.component.jpa.JpaComponent">
   <property name="entityManagerFactory" ref="myEMFactory"/>
   <property name="transactionManager" ref="myTransactionManager"/>
</bean>

...

Using a consumer with a named query

...