// kafka-connector options: START
[[camel-jpa-kafka-connector-sink]]
= camel-jpa-kafka-connector sink configuration

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

When using camel-jpa-kafka-connector as sink make sure to use the following Maven dependency to have support for the connector:

[source,xml]
----
<dependency>
  <groupId>org.apache.camel.kafkaconnector</groupId>
  <artifactId>camel-jpa-kafka-connector</artifactId>
  <version>x.x.x</version>
  <!-- use the same version as your Camel Kafka connector version -->
</dependency>
----

To use this Sink connector in Kafka connect you'll need to set the following connector.class

[source,java]
----
connector.class=org.apache.camel.kafkaconnector.jpa.CamelJpaSinkConnector
----


The camel-jpa sink connector supports 23 options, which are listed below.



[width="100%",cols="2,5,^1,1,1",options="header"]
|===
| Name | Description | Default | Required | Priority
| *camel.sink.path.entityType* | Entity class name | null | true | HIGH
| *camel.sink.endpoint.joinTransaction* | The camel-jpa component will join transaction by default. 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 JpaComponent, instead of having to set it on all endpoints. | true | false | MEDIUM
| *camel.sink.endpoint.maximumResults* | Set the maximum number of results to retrieve on the Query. | -1 | false | MEDIUM
| *camel.sink.endpoint.namedQuery* | To use a named query. | null | false | MEDIUM
| *camel.sink.endpoint.nativeQuery* | To use a custom native query. You may want to use the option resultClass also when using native queries. | null | false | MEDIUM
| *camel.sink.endpoint.persistenceUnit* | The JPA persistence unit used by default. | "camel" | true | HIGH
| *camel.sink.endpoint.query* | To use a custom query. | null | false | MEDIUM
| *camel.sink.endpoint.resultClass* | Defines the type of the returned payload (we will call entityManager.createNativeQuery(nativeQuery, resultClass) instead of entityManager.createNativeQuery(nativeQuery)). Without this option, we will return an object array. Only has an affect when using in conjunction with native query when consuming data. | null | false | MEDIUM
| *camel.sink.endpoint.findEntity* | If enabled then the producer will find a single entity by using the message body as key and entityType as the class type. This can be used instead of a query to find a single entity. | false | false | MEDIUM
| *camel.sink.endpoint.flushOnSend* | Flushes the EntityManager after the entity bean has been persisted. | true | false | MEDIUM
| *camel.sink.endpoint.lazyStartProducer* | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | false | MEDIUM
| *camel.sink.endpoint.remove* | Indicates to use entityManager.remove(entity). | false | false | MEDIUM
| *camel.sink.endpoint.useExecuteUpdate* | 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'. | null | false | MEDIUM
| *camel.sink.endpoint.usePersist* | Indicates to use entityManager.persist(entity) instead of entityManager.merge(entity). Note: entityManager.persist(entity) doesn't work for detached entities (where the EntityManager has to execute an UPDATE instead of an INSERT query)! | false | false | MEDIUM
| *camel.sink.endpoint.usePassedInEntityManager* | If set to true, then Camel will use the EntityManager from the header JpaConstants.ENTITY_MANAGER instead of the configured entity manager on the component/endpoint. This allows end users to control which entity manager will be in use. | false | false | MEDIUM
| *camel.sink.endpoint.entityManagerProperties* | Additional properties for the entity manager to use. | null | false | MEDIUM
| *camel.sink.endpoint.sharedEntityManager* | Whether to use Spring's SharedEntityManager for the consumer/producer. Note in most cases joinTransaction should be set to false as this is not an EXTENDED EntityManager. | false | false | MEDIUM
| *camel.component.jpa.entityManagerFactory* | To use the EntityManagerFactory. This is strongly recommended to configure. | null | false | MEDIUM
| *camel.component.jpa.joinTransaction* | The camel-jpa component will join transaction by default. 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 JpaComponent, instead of having to set it on all endpoints. | true | false | MEDIUM
| *camel.component.jpa.sharedEntityManager* | Whether to use Spring's SharedEntityManager for the consumer/producer. Note in most cases joinTransaction should be set to false as this is not an EXTENDED EntityManager. | false | false | MEDIUM
| *camel.component.jpa.transactionManager* | To use the PlatformTransactionManager for managing transactions. | null | false | MEDIUM
| *camel.component.jpa.lazyStartProducer* | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | false | MEDIUM
| *camel.component.jpa.autowiredEnabled* | Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | false | MEDIUM
|===



The camel-jpa sink connector has no converters out of the box.





The camel-jpa sink connector has no transforms out of the box.





The camel-jpa sink connector has no aggregation strategies out of the box.




// kafka-connector options: END
