JPA

JVM since1.0.0 Native since1.0.0

Store and retrieve Java objects from databases using Java Persistence API (JPA).

What’s inside

Please refer to the above link for usage and configuration details.

Maven coordinates

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-jpa</artifactId>
</dependency>

Check the User guide for more information about writing Camel Quarkus applications.

Additional Camel Quarkus configuration

The extension leverages Quarkus Hibernate ORM to provide the JPA implementation via Hibernate.

Refer to the Quarkus Hibernate ORM documentation to see how to configure Hibernate and your datasource.

Also, it leverages Quarkus TX API to provide TransactionStrategy implementation.

When a single persistence unit is used, the Camel Quarkus JPA extension will automatically configure the JPA component with a EntityManagerFactory and TransactionStrategy.

Configuring JpaMessageIdRepository

It needs to use EntityManagerFactory and TransactionStrategy from the CDI container to configure the JpaMessageIdRepository:

@Inject
EntityManagerFactory entityManagerFactory;

@Inject
TransactionStrategy transactionStrategy;

from("direct:idempotent")
    .idempotentConsumer(
        header("messageId"),
        new JpaMessageIdRepository(entityManagerFactory, transactionStrategy, "idempotentProcessor"));

Since it excludes the spring-orm dependency, some options such as sharedEntityManager, transactionManager are not supported.