This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 7b5869ab1ada CAMEL-27938: camel-jpa - fail on an unknown entityType,
close the EntityManager of the polling consumer (#31303)
7b5869ab1ada is described below
commit 7b5869ab1adaeb98efc3ea55d1f58885c8959e88
Author: Adriano Machado <[email protected]>
AuthorDate: Thu Dec 3 16:11:10 2026 -0500
CAMEL-27938: camel-jpa - fail on an unknown entityType, close the
EntityManager of the polling consumer (#31303)
- JpaComponent resolves the entity class with resolveMandatoryClass (after
the
alias lookup), so a misspelled class name fails endpoint creation instead
of
leaving entityType null.
- JpaPollingConsumer binds the EntityManager it creates to the polled
exchange,
so JpaCloseEntityManagerOnCompletion closes it when the exchange is done
(pollEnrich hands it over to the enriched exchange, a ConsumerTemplate
closes
it on doneUoW). It was only closed on a PersistenceException before.
- The CamelEntityManager exchange property of the polled exchange is removed
again, as pollEnrich copies the properties and later jpa producers would
reuse
the EntityManager of the poll. When the poll fails, the exchange is
released
so its EntityManager is closed.
- JpaHelper.getTargetEntityManager honours allowRecreate (missing
parentheses).
- entityType and persistenceUnit are no longer marked required; the
CamelJpaMaximumResults and CamelJpaFirstResult headers are Integer.
- Doc page: the WARN is logged when no EntityManagerFactory is configured.
- JpaTest built the List endpoint without a '?', so
entityType=java.util.List
ended up in the class name and was silently ignored.
- Upgrade guide entry for 4.25.
_Claude Code on behalf of Adriano Machado (@ammachado)_
Co-authored-by: Claude Opus 5 <[email protected]>
Co-authored-by: Claude Sonnet 5.5 <[email protected]>
---
.../org/apache/camel/catalog/components/jpa.json | 8 +-
.../apache/camel/catalog/docs/jpa-component.adoc | 6 +-
.../camel/component/jpa/JpaEndpointUriFactory.java | 2 +-
.../org/apache/camel/component/jpa/jpa.json | 8 +-
.../camel-jpa/src/main/docs/jpa-component.adoc | 6 +-
.../apache/camel/component/jpa/JpaComponent.java | 8 +-
.../apache/camel/component/jpa/JpaConstants.java | 6 +-
.../apache/camel/component/jpa/JpaEndpoint.java | 3 -
.../org/apache/camel/component/jpa/JpaHelper.java | 2 +-
.../camel/component/jpa/JpaPollingConsumer.java | 26 +++-
.../camel/component/jpa/JpaComponentTest.java | 13 ++
.../apache/camel/component/jpa/JpaHelperTest.java | 78 +++++++++++
.../org/apache/camel/component/jpa/JpaTest.java | 5 +-
.../JpaPollingConsumerCloseEntityManagerTest.java | 154 +++++++++++++++++++++
.../ROOT/pages/camel-4x-upgrade-guide-4_25.adoc | 18 ++-
.../builder/endpoint/StaticEndpointBuilders.java | 4 +-
.../endpoint/dsl/JpaEndpointBuilderFactory.java | 11 +-
17 files changed, 317 insertions(+), 41 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/jpa.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/jpa.json
index efd5d8895fbe..325ce5967653 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/jpa.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/jpa.json
@@ -38,8 +38,8 @@
"headers": {
"CamelEntityManager": { "index": 0, "kind": "header", "displayName": "",
"group": "common", "label": "", "required": false, "javaType":
"jakarta.persistence.EntityManager", "deprecated": false, "autowired": false,
"secret": false, "description": "The EntityManager of the consumer that read
the entity. The producer uses the EntityManager of this header when
usePassedInEntityManager is enabled.", "constantName":
"org.apache.camel.component.jpa.JpaConstants#ENTITY_MANAGER" },
"CamelJpaParameters": { "index": 1, "kind": "header", "displayName": "",
"group": "producer", "label": "producer", "required": false, "javaType":
"Map<String, Object>", "deprecated": false, "autowired": false, "secret":
false, "description": "Alternative way for passing query parameters as an
Exchange header. The parameter values are used as-is without expression
evaluation.", "constantName":
"org.apache.camel.component.jpa.JpaConstants#JPA_PARAMETERS_HEADER" },
- "CamelJpaMaximumResults": { "index": 2, "kind": "header", "displayName":
"", "group": "producer", "label": "producer", "required": false, "javaType":
"", "deprecated": false, "autowired": false, "secret": false, "description":
"Defines the maximum number of results to retrieve on the query; takes
precedence over the value set on the endpoint, if any.", "constantName":
"org.apache.camel.component.jpa.JpaConstants#JPA_MAXIMUM_RESULTS" },
- "CamelJpaFirstResult": { "index": 3, "kind": "header", "displayName": "",
"group": "producer", "label": "producer", "required": false, "javaType": "",
"deprecated": false, "autowired": false, "secret": false, "description":
"Defines the position of the first result to retrieve; takes precedence over
the value set on the endpoint, if any.", "constantName":
"org.apache.camel.component.jpa.JpaConstants#JPA_FIRST_RESULT" }
+ "CamelJpaMaximumResults": { "index": 2, "kind": "header", "displayName":
"", "group": "producer", "label": "producer", "required": false, "javaType":
"java.lang.Integer", "deprecated": false, "autowired": false, "secret": false,
"description": "Defines the maximum number of results to retrieve on the query;
takes precedence over the value set on the endpoint, if any.", "constantName":
"org.apache.camel.component.jpa.JpaConstants#JPA_MAXIMUM_RESULTS" },
+ "CamelJpaFirstResult": { "index": 3, "kind": "header", "displayName": "",
"group": "producer", "label": "producer", "required": false, "javaType":
"java.lang.Integer", "deprecated": false, "autowired": false, "secret": false,
"description": "Defines the position of the first result to retrieve; takes
precedence over the value set on the endpoint, if any.", "constantName":
"org.apache.camel.component.jpa.JpaConstants#JPA_FIRST_RESULT" }
},
"bodyTypes": {
"consumerOut": { "carriers": [ "pojo" ], "dependsOn": [ "query",
"namedQuery", "nativeQuery" ], "javaTypeOption": "entityType", "description":
"One entity of the entityType class per message. A query that selects columns
gives one row per message: an Object array, or the value of a single column; a
nativeQuery gives an Object array unless resultClass is set" },
@@ -47,13 +47,13 @@
"producerOut": { "carriers": [ "pojo", "list" ], "dependsOn": [ "query",
"namedQuery", "nativeQuery", "outputTarget" ], "byOption": [ { "option":
"usePersist", "value": "true", "carriers": [ "unchanged" ] }, { "option":
"findEntity", "value": "true", "carriers": [ "pojo", "null" ],
"javaTypeOption": "entityType" } ], "description": "The managed entity that
merge returns, or a List or array of them; usePersist leaves the body as sent.
findEntity gives the entity, or null when there is [...]
},
"properties": {
- "entityType": { "index": 0, "kind": "path", "displayName": "Entity Type",
"group": "common", "label": "", "required": true, "type": "string", "javaType":
"java.lang.Class<java.lang.Object>", "deprecated": false, "autowired": false,
"secret": false, "description": "The entity class: its fully qualified class
name, or an alias from the aliases component option. The consumer polls the
entities of this class when no query is set, the producer converts the message
body to it, and findEnti [...]
+ "entityType": { "index": 0, "kind": "path", "displayName": "Entity Type",
"group": "common", "label": "", "required": false, "type": "string",
"javaType": "java.lang.Class<java.lang.Object>", "deprecated": false,
"autowired": false, "secret": false, "description": "The entity class: its
fully qualified class name, or an alias from the aliases component option. The
consumer polls the entities of this class when no query is set, the producer
converts the message body to it, and findEnt [...]
"entityManagerFactory": { "index": 1, "kind": "parameter", "displayName":
"Entity Manager Factory", "group": "common", "label": "", "required": false,
"type": "object", "javaType": "jakarta.persistence.EntityManagerFactory",
"deprecated": false, "autowired": false, "secret": false, "description": "The
EntityManagerFactory to use. If not set, the one of the component is used, and
otherwise the endpoint creates one from the persistenceUnit." },
"joinTransaction": { "index": 2, "kind": "parameter", "displayName": "Join
Transaction", "group": "common", "label": "", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": true, "description": "Whether the
EntityManager joins the current transaction (EntityManager.joinTransaction())
before each operation. Turn it off if this does not work with your JPA
provider, for example with a RESOURCE_LOCAL persi [...]
"maximumResults": { "index": 3, "kind": "parameter", "displayName":
"Maximum Results", "group": "common", "label": "", "required": false, "type":
"integer", "javaType": "int", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": -1, "description": "The maximum number of
results that a query retrieves (Query.setMaxResults()), for the consumer and
the producer. The default -1 (or 0) sets no limit. In the producer the
CamelJpaMaximumResults header overrides it." },
"namedQuery": { "index": 4, "kind": "parameter", "displayName": "Named
Query", "group": "common", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "The name of a named query to run instead of
query, such as one defined with NamedQuery on an entity class. It takes
precedence over nativeQuery. The producer runs an UPDATE or DELETE named query
only with useExecuteUpdate=true." },
"nativeQuery": { "index": 5, "kind": "parameter", "displayName": "Native
Query", "group": "common", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "The native SQL query to run instead of query
or namedQuery. Each result is an Object array (or the value, with one column),
unless resultClass is set." },
- "persistenceUnit": { "index": 6, "kind": "parameter", "displayName":
"Persistence Unit", "group": "common", "label": "", "required": true, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": "camel", "description": "The name of
the persistence unit from which the endpoint creates its own
EntityManagerFactory when neither the endpoint nor the component has one." },
+ "persistenceUnit": { "index": 6, "kind": "parameter", "displayName":
"Persistence Unit", "group": "common", "label": "", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": "camel", "description": "The name of
the persistence unit from which the endpoint creates its own
EntityManagerFactory when neither the endpoint nor the component has one." },
"query": { "index": 7, "kind": "parameter", "displayName": "Query",
"group": "common", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "The JPQL query to run. The consumer polls with
it, and the producer runs it instead of storing the message body. It takes
precedence over namedQuery and nativeQuery." },
"resultClass": { "index": 8, "kind": "parameter", "displayName": "Result
Class", "group": "common", "label": "", "required": false, "type": "string",
"javaType": "java.lang.Class<java.lang.Object>", "deprecated": false,
"autowired": false, "secret": false, "description": "The class of the results
of a nativeQuery (EntityManager.createNativeQuery(nativeQuery, resultClass)),
usually an entity class. Without it, each result is an Object array (or the
value, with one column). Only used w [...]
"consumeDelete": { "index": 9, "kind": "parameter", "displayName":
"Consume Delete", "group": "consumer", "label": "consumer", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": true, "description": "Whether the
consumer deletes each entity (EntityManager.remove()) after it has routed it
successfully. Not used when the entity class has a method annotated with
Consumed, or when a deleteHandler is set." },
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/jpa-component.adoc
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/jpa-component.adoc
index e43bb2ae3a04..e64cfadbdd2c 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/jpa-component.adoc
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/jpa-component.adoc
@@ -195,8 +195,10 @@ For example, you can instantiate a JPA component that
references the
The `JpaComponent` looks up automatically the
`EntityManagerFactory` from the Registry which means
you do not need to configure this on the `JpaComponent` as shown above.
-You only need to do so if there is ambiguity, in which case Camel will
-log a WARN.
+You only need to do so if there is ambiguity: when the Registry has more than
+one `EntityManagerFactory`, none of them is used automatically.
+When the `JpaComponent` has no `EntityManagerFactory`, Camel logs a WARN
+and each endpoint creates its own.
=== Configuring TransactionStrategy
diff --git
a/components/camel-jpa/src/generated/java/org/apache/camel/component/jpa/JpaEndpointUriFactory.java
b/components/camel-jpa/src/generated/java/org/apache/camel/component/jpa/JpaEndpointUriFactory.java
index ef8dfc3a8362..b0c2dd387047 100644
---
a/components/camel-jpa/src/generated/java/org/apache/camel/component/jpa/JpaEndpointUriFactory.java
+++
b/components/camel-jpa/src/generated/java/org/apache/camel/component/jpa/JpaEndpointUriFactory.java
@@ -98,7 +98,7 @@ public class JpaEndpointUriFactory extends
org.apache.camel.support.component.En
Map<String, Object> copy = copyParameters(properties);
- uri = buildPathParameter(syntax, uri, "entityType", null, true, copy);
+ uri = buildPathParameter(syntax, uri, "entityType", null, false, copy);
uri = buildQueryParameters(uri, copy, encode);
return uri;
}
diff --git
a/components/camel-jpa/src/generated/resources/META-INF/org/apache/camel/component/jpa/jpa.json
b/components/camel-jpa/src/generated/resources/META-INF/org/apache/camel/component/jpa/jpa.json
index efd5d8895fbe..325ce5967653 100644
---
a/components/camel-jpa/src/generated/resources/META-INF/org/apache/camel/component/jpa/jpa.json
+++
b/components/camel-jpa/src/generated/resources/META-INF/org/apache/camel/component/jpa/jpa.json
@@ -38,8 +38,8 @@
"headers": {
"CamelEntityManager": { "index": 0, "kind": "header", "displayName": "",
"group": "common", "label": "", "required": false, "javaType":
"jakarta.persistence.EntityManager", "deprecated": false, "autowired": false,
"secret": false, "description": "The EntityManager of the consumer that read
the entity. The producer uses the EntityManager of this header when
usePassedInEntityManager is enabled.", "constantName":
"org.apache.camel.component.jpa.JpaConstants#ENTITY_MANAGER" },
"CamelJpaParameters": { "index": 1, "kind": "header", "displayName": "",
"group": "producer", "label": "producer", "required": false, "javaType":
"Map<String, Object>", "deprecated": false, "autowired": false, "secret":
false, "description": "Alternative way for passing query parameters as an
Exchange header. The parameter values are used as-is without expression
evaluation.", "constantName":
"org.apache.camel.component.jpa.JpaConstants#JPA_PARAMETERS_HEADER" },
- "CamelJpaMaximumResults": { "index": 2, "kind": "header", "displayName":
"", "group": "producer", "label": "producer", "required": false, "javaType":
"", "deprecated": false, "autowired": false, "secret": false, "description":
"Defines the maximum number of results to retrieve on the query; takes
precedence over the value set on the endpoint, if any.", "constantName":
"org.apache.camel.component.jpa.JpaConstants#JPA_MAXIMUM_RESULTS" },
- "CamelJpaFirstResult": { "index": 3, "kind": "header", "displayName": "",
"group": "producer", "label": "producer", "required": false, "javaType": "",
"deprecated": false, "autowired": false, "secret": false, "description":
"Defines the position of the first result to retrieve; takes precedence over
the value set on the endpoint, if any.", "constantName":
"org.apache.camel.component.jpa.JpaConstants#JPA_FIRST_RESULT" }
+ "CamelJpaMaximumResults": { "index": 2, "kind": "header", "displayName":
"", "group": "producer", "label": "producer", "required": false, "javaType":
"java.lang.Integer", "deprecated": false, "autowired": false, "secret": false,
"description": "Defines the maximum number of results to retrieve on the query;
takes precedence over the value set on the endpoint, if any.", "constantName":
"org.apache.camel.component.jpa.JpaConstants#JPA_MAXIMUM_RESULTS" },
+ "CamelJpaFirstResult": { "index": 3, "kind": "header", "displayName": "",
"group": "producer", "label": "producer", "required": false, "javaType":
"java.lang.Integer", "deprecated": false, "autowired": false, "secret": false,
"description": "Defines the position of the first result to retrieve; takes
precedence over the value set on the endpoint, if any.", "constantName":
"org.apache.camel.component.jpa.JpaConstants#JPA_FIRST_RESULT" }
},
"bodyTypes": {
"consumerOut": { "carriers": [ "pojo" ], "dependsOn": [ "query",
"namedQuery", "nativeQuery" ], "javaTypeOption": "entityType", "description":
"One entity of the entityType class per message. A query that selects columns
gives one row per message: an Object array, or the value of a single column; a
nativeQuery gives an Object array unless resultClass is set" },
@@ -47,13 +47,13 @@
"producerOut": { "carriers": [ "pojo", "list" ], "dependsOn": [ "query",
"namedQuery", "nativeQuery", "outputTarget" ], "byOption": [ { "option":
"usePersist", "value": "true", "carriers": [ "unchanged" ] }, { "option":
"findEntity", "value": "true", "carriers": [ "pojo", "null" ],
"javaTypeOption": "entityType" } ], "description": "The managed entity that
merge returns, or a List or array of them; usePersist leaves the body as sent.
findEntity gives the entity, or null when there is [...]
},
"properties": {
- "entityType": { "index": 0, "kind": "path", "displayName": "Entity Type",
"group": "common", "label": "", "required": true, "type": "string", "javaType":
"java.lang.Class<java.lang.Object>", "deprecated": false, "autowired": false,
"secret": false, "description": "The entity class: its fully qualified class
name, or an alias from the aliases component option. The consumer polls the
entities of this class when no query is set, the producer converts the message
body to it, and findEnti [...]
+ "entityType": { "index": 0, "kind": "path", "displayName": "Entity Type",
"group": "common", "label": "", "required": false, "type": "string",
"javaType": "java.lang.Class<java.lang.Object>", "deprecated": false,
"autowired": false, "secret": false, "description": "The entity class: its
fully qualified class name, or an alias from the aliases component option. The
consumer polls the entities of this class when no query is set, the producer
converts the message body to it, and findEnt [...]
"entityManagerFactory": { "index": 1, "kind": "parameter", "displayName":
"Entity Manager Factory", "group": "common", "label": "", "required": false,
"type": "object", "javaType": "jakarta.persistence.EntityManagerFactory",
"deprecated": false, "autowired": false, "secret": false, "description": "The
EntityManagerFactory to use. If not set, the one of the component is used, and
otherwise the endpoint creates one from the persistenceUnit." },
"joinTransaction": { "index": 2, "kind": "parameter", "displayName": "Join
Transaction", "group": "common", "label": "", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": true, "description": "Whether the
EntityManager joins the current transaction (EntityManager.joinTransaction())
before each operation. Turn it off if this does not work with your JPA
provider, for example with a RESOURCE_LOCAL persi [...]
"maximumResults": { "index": 3, "kind": "parameter", "displayName":
"Maximum Results", "group": "common", "label": "", "required": false, "type":
"integer", "javaType": "int", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": -1, "description": "The maximum number of
results that a query retrieves (Query.setMaxResults()), for the consumer and
the producer. The default -1 (or 0) sets no limit. In the producer the
CamelJpaMaximumResults header overrides it." },
"namedQuery": { "index": 4, "kind": "parameter", "displayName": "Named
Query", "group": "common", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "The name of a named query to run instead of
query, such as one defined with NamedQuery on an entity class. It takes
precedence over nativeQuery. The producer runs an UPDATE or DELETE named query
only with useExecuteUpdate=true." },
"nativeQuery": { "index": 5, "kind": "parameter", "displayName": "Native
Query", "group": "common", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "The native SQL query to run instead of query
or namedQuery. Each result is an Object array (or the value, with one column),
unless resultClass is set." },
- "persistenceUnit": { "index": 6, "kind": "parameter", "displayName":
"Persistence Unit", "group": "common", "label": "", "required": true, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": "camel", "description": "The name of
the persistence unit from which the endpoint creates its own
EntityManagerFactory when neither the endpoint nor the component has one." },
+ "persistenceUnit": { "index": 6, "kind": "parameter", "displayName":
"Persistence Unit", "group": "common", "label": "", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": "camel", "description": "The name of
the persistence unit from which the endpoint creates its own
EntityManagerFactory when neither the endpoint nor the component has one." },
"query": { "index": 7, "kind": "parameter", "displayName": "Query",
"group": "common", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "The JPQL query to run. The consumer polls with
it, and the producer runs it instead of storing the message body. It takes
precedence over namedQuery and nativeQuery." },
"resultClass": { "index": 8, "kind": "parameter", "displayName": "Result
Class", "group": "common", "label": "", "required": false, "type": "string",
"javaType": "java.lang.Class<java.lang.Object>", "deprecated": false,
"autowired": false, "secret": false, "description": "The class of the results
of a nativeQuery (EntityManager.createNativeQuery(nativeQuery, resultClass)),
usually an entity class. Without it, each result is an Object array (or the
value, with one column). Only used w [...]
"consumeDelete": { "index": 9, "kind": "parameter", "displayName":
"Consume Delete", "group": "consumer", "label": "consumer", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": true, "description": "Whether the
consumer deletes each entity (EntityManager.remove()) after it has routed it
successfully. Not used when the entity class has a method annotated with
Consumed, or when a deleteHandler is set." },
diff --git a/components/camel-jpa/src/main/docs/jpa-component.adoc
b/components/camel-jpa/src/main/docs/jpa-component.adoc
index e43bb2ae3a04..e64cfadbdd2c 100644
--- a/components/camel-jpa/src/main/docs/jpa-component.adoc
+++ b/components/camel-jpa/src/main/docs/jpa-component.adoc
@@ -195,8 +195,10 @@ For example, you can instantiate a JPA component that
references the
The `JpaComponent` looks up automatically the
`EntityManagerFactory` from the Registry which means
you do not need to configure this on the `JpaComponent` as shown above.
-You only need to do so if there is ambiguity, in which case Camel will
-log a WARN.
+You only need to do so if there is ambiguity: when the Registry has more than
+one `EntityManagerFactory`, none of them is used automatically.
+When the `JpaComponent` has no `EntityManagerFactory`, Camel logs a WARN
+and each endpoint creates its own.
=== Configuring TransactionStrategy
diff --git
a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaComponent.java
b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaComponent.java
index a2d7e2523cd2..bcd4e2a27505 100644
---
a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaComponent.java
+++
b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaComponent.java
@@ -151,12 +151,10 @@ public class JpaComponent extends HealthCheckComponent {
if (type == null) {
// provide the class loader of this component to work in OSGi
environments as camel-jpa must be able
// to resolve the entity classes
- type = getCamelContext().getClassResolver().resolveClass(path,
JpaComponent.class.getClassLoader());
- }
-
- if (type != null) {
- endpoint.setEntityType(type);
+ type =
getCamelContext().getClassResolver().resolveMandatoryClass(path,
+ JpaComponent.class.getClassLoader());
}
+ endpoint.setEntityType(type);
}
setProperties(endpoint, options);
return endpoint;
diff --git
a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConstants.java
b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConstants.java
index bf20d95e9883..0c3d8d40c5a4 100644
---
a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConstants.java
+++
b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConstants.java
@@ -33,10 +33,12 @@ public final class JpaConstants {
javaType = "Map<String, Object>")
public static final String JPA_PARAMETERS_HEADER = "CamelJpaParameters";
@Metadata(label = "producer", description = "Defines the maximum number of
results to retrieve on the query; " +
- "takes precedence over the
value set on the endpoint, if any.")
+ "takes precedence over the
value set on the endpoint, if any.",
+ javaType = "java.lang.Integer")
public static final String JPA_MAXIMUM_RESULTS = "CamelJpaMaximumResults";
@Metadata(label = "producer", description = "Defines the position of the
first result to retrieve; " +
- "takes precedence over the
value set on the endpoint, if any.")
+ "takes precedence over the
value set on the endpoint, if any.",
+ javaType = "java.lang.Integer")
public static final String JPA_FIRST_RESULT = "CamelJpaFirstResult";
/**
diff --git
a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java
b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java
index 7394f29992c3..0d23ca6ee06e 100644
---
a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java
+++
b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java
@@ -34,7 +34,6 @@ import org.apache.camel.Producer;
import org.apache.camel.spi.BodyType;
import org.apache.camel.spi.BodyType.Carrier;
import org.apache.camel.spi.BodyTypes;
-import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.UriEndpoint;
import org.apache.camel.spi.UriParam;
import org.apache.camel.spi.UriPath;
@@ -91,11 +90,9 @@ public class JpaEndpoint extends ScheduledPollEndpoint {
@UriPath(description = "The entity class: its fully qualified class name,
or an alias from the aliases component "
+ "option. The consumer polls the entities of this
class when no query is set, the producer "
+ "converts the message body to it, and findEntity
finds an entity of this class.")
- @Metadata(required = true)
private Class<?> entityType;
@UriParam(defaultValue = "camel", description = "The name of the
persistence unit from which the endpoint creates its own "
+ "EntityManagerFactory
when neither the endpoint nor the component has one.")
- @Metadata(required = true)
private String persistenceUnit = "camel";
@UriParam(defaultValue = "true",
description = "Whether the EntityManager joins the current
transaction (EntityManager.joinTransaction()) "
diff --git
a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaHelper.java
b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaHelper.java
index ab0e5fccbeb7..90bed7487f4e 100644
---
a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaHelper.java
+++
b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaHelper.java
@@ -84,7 +84,7 @@ public final class JpaHelper {
em = createEntityManager(exchange, entityManagerFactory);
}
- if (allowRecreate && em == null || !em.isOpen()) {
+ if (allowRecreate && (em == null || !em.isOpen())) {
em = createEntityManager(exchange, entityManagerFactory);
}
diff --git
a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaPollingConsumer.java
b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaPollingConsumer.java
index 3e327fd384b0..55a741a257ab 100644
---
a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaPollingConsumer.java
+++
b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaPollingConsumer.java
@@ -35,6 +35,7 @@ import jakarta.persistence.Query;
import org.apache.camel.Exchange;
import org.apache.camel.RuntimeCamelException;
import org.apache.camel.support.PollingConsumerSupport;
+import org.apache.camel.support.UnitOfWorkHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -134,12 +135,27 @@ public class JpaPollingConsumer extends
PollingConsumerSupport {
}
private Exchange doReceive(boolean useLocking) {
- // resolve the entity manager before evaluating the expression
- final EntityManager entityManager = getTargetEntityManager(null,
entityManagerFactory,
- getEndpoint().isUsePassedInEntityManager(),
getEndpoint().isSharedEntityManager(), true);
-
+ // bind the entity manager to the exchange, so it is closed when the
exchange is done
+ // (pollEnrich hands this over to the enriched exchange)
Exchange exchange = getEndpoint().createExchange();
+ final EntityManager entityManager = getTargetEntityManager(exchange,
entityManagerFactory,
+ getEndpoint().isUsePassedInEntityManager(),
getEndpoint().isSharedEntityManager(), true);
+ // keep only the close on completion: pollEnrich copies exchange
properties onto the enriched exchange,
+ // where later jpa producers would otherwise reuse this EntityManager
+ exchange.removeProperty(JpaConstants.ENTITY_MANAGER);
exchange.getIn().setHeader(JpaConstants.ENTITY_MANAGER, entityManager);
+ try {
+ executeQuery(exchange, entityManager, useLocking);
+ } catch (RuntimeException e) {
+ // the exchange is not returned, so release what is bound to it
(closes the EntityManager)
+ UnitOfWorkHelper.doneSynchronizations(exchange,
exchange.getExchangeExtension().handoverCompletions());
+ throw e;
+ }
+
+ return exchange;
+ }
+
+ private void executeQuery(Exchange exchange, EntityManager entityManager,
boolean useLocking) {
transactionStrategy.executeInTransaction(new Runnable() {
@Override
public void run() {
@@ -190,8 +206,6 @@ public class JpaPollingConsumer extends
PollingConsumerSupport {
}
});
-
- return exchange;
}
@Override
diff --git
a/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaComponentTest.java
b/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaComponentTest.java
index a4f00a3b4fa1..835fc25d9ee7 100644
---
a/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaComponentTest.java
+++
b/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaComponentTest.java
@@ -23,6 +23,7 @@ import jakarta.persistence.EntityManagerFactory;
import jakarta.persistence.LockModeType;
import jakarta.persistence.Persistence;
+import org.apache.camel.ResolveEndpointFailedException;
import org.apache.camel.examples.SendEmail;
import org.apache.camel.test.junit6.CamelTestSupport;
import org.apache.logging.log4j.Level;
@@ -39,6 +40,7 @@ import static
org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class JpaComponentTest extends CamelTestSupport {
@@ -72,6 +74,17 @@ public class JpaComponentTest extends CamelTestSupport {
}
}
+ @Test
+ public void testUnknownEntityTypeFailsEndpointCreation() {
+ // a typo in the entity class name must fail fast, and not leave
entityType null so that the producer
+ // stores the body unconverted and the consumer fails later with an
unrelated error
+ ResolveEndpointFailedException e =
assertThrows(ResolveEndpointFailedException.class,
+ () ->
context.getEndpoint("jpa://org.apache.camel.examples.DoesNotExist"));
+ assertInstanceOf(ClassNotFoundException.class, e.getCause());
+
assertTrue(e.getCause().getMessage().contains("org.apache.camel.examples.DoesNotExist"),
+ "The error should name the class that cannot be found: " +
e.getCause().getMessage());
+ }
+
@Test
public void testJpaComponentEMFandTM() throws Exception {
try (JpaComponent comp = new JpaComponent()) {
diff --git
a/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaHelperTest.java
b/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaHelperTest.java
new file mode 100644
index 000000000000..c1f6444a87d1
--- /dev/null
+++
b/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaHelperTest.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jpa;
+
+import jakarta.persistence.EntityManager;
+import jakarta.persistence.EntityManagerFactory;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.support.DefaultExchange;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+public class JpaHelperTest {
+
+ private CamelContext camelContext;
+ private EntityManagerFactory entityManagerFactory;
+ private EntityManager closedEntityManager;
+ private EntityManager newEntityManager;
+ private Exchange exchange;
+
+ @BeforeEach
+ public void setUp() {
+ camelContext = new DefaultCamelContext();
+ entityManagerFactory = mock(EntityManagerFactory.class);
+ closedEntityManager = mock(EntityManager.class);
+ when(closedEntityManager.isOpen()).thenReturn(false);
+ newEntityManager = mock(EntityManager.class);
+ when(newEntityManager.isOpen()).thenReturn(true);
+
when(entityManagerFactory.createEntityManager()).thenReturn(newEntityManager);
+
+ exchange = new DefaultExchange(camelContext);
+ exchange.getIn().setHeader(JpaConstants.ENTITY_MANAGER,
closedEntityManager);
+ }
+
+ @AfterEach
+ public void tearDown() throws Exception {
+ camelContext.close();
+ }
+
+ @Test
+ public void testClosedEntityManagerIsRecreatedWhenAllowed() {
+ EntityManager em = JpaHelper.getTargetEntityManager(exchange,
entityManagerFactory, true, false, true);
+
+ assertSame(newEntityManager, em);
+ }
+
+ @Test
+ public void testClosedEntityManagerIsKeptWhenRecreateIsNotAllowed() {
+ // allowRecreate=false must be honoured: the passed-in EntityManager
is returned as is
+ EntityManager em = JpaHelper.getTargetEntityManager(exchange,
entityManagerFactory, true, false, false);
+
+ assertSame(closedEntityManager, em);
+ verify(entityManagerFactory, never()).createEntityManager();
+ }
+}
diff --git
a/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaTest.java
b/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaTest.java
index 22df220e5ece..9e69d183a1c2 100644
---
a/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaTest.java
+++
b/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaTest.java
@@ -131,7 +131,10 @@ public class JpaTest {
assertTrue(value instanceof JpaEndpoint, "Should be a JPA endpoint but
was: " + value);
endpoint = (JpaEndpoint) value;
- listEndpoint = camelContext.getEndpoint(getEndpointUri() +
"&entityType=java.util.List", JpaEndpoint.class);
+ // entityType is a query parameter here, overriding the entity class
of the path
+ String separator = getEndpointUri().contains("?") ? "&" : "?";
+ listEndpoint = camelContext.getEndpoint(getEndpointUri() + separator +
"entityType=java.util.List",
+ JpaEndpoint.class);
if (endpoint.getTransactionStrategy() instanceof
DefaultTransactionStrategy strategy) {
transactionTemplate = strategy.getTransactionTemplate();
diff --git
a/components/camel-jpa/src/test/java/org/apache/camel/processor/jpa/JpaPollingConsumerCloseEntityManagerTest.java
b/components/camel-jpa/src/test/java/org/apache/camel/processor/jpa/JpaPollingConsumerCloseEntityManagerTest.java
new file mode 100644
index 000000000000..45fd184e5c49
--- /dev/null
+++
b/components/camel-jpa/src/test/java/org/apache/camel/processor/jpa/JpaPollingConsumerCloseEntityManagerTest.java
@@ -0,0 +1,154 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.processor.jpa;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicReference;
+
+import jakarta.persistence.EntityManager;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.jpa.JpaConstants;
+import org.apache.camel.component.jpa.JpaEndpoint;
+import org.apache.camel.component.jpa.JpaPollingConsumer;
+import org.apache.camel.examples.Customer;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * The polling consumer (pollEnrich, ConsumerTemplate) creates an
EntityManager for each poll: it must be closed when
+ * the polled exchange is done, otherwise every poll leaks an EntityManager
and its JDBC connection.
+ */
+public class JpaPollingConsumerCloseEntityManagerTest extends AbstractJpaTest {
+ protected static final String SELECT_ALL_STRING = "select x from " +
Customer.class.getName() + " x";
+ private static final String QUERY_URI
+ = "jpa://" + Customer.class.getName() + "?query=select c from
Customer c where c.name = 'Donald Duck'";
+
+ private final AtomicReference<EntityManager> polledEntityManager = new
AtomicReference<>();
+ private final AtomicBoolean openDuringAggregation = new AtomicBoolean();
+ private final AtomicReference<Object> propertyAfterPollEnrich = new
AtomicReference<>();
+
+ @Test
+ public void testPollEnrichClosesEntityManagerWhenExchangeIsDone() {
+ saveCustomer("Donald Duck");
+
+ String reply = template.requestBody("direct:start", "Hello",
String.class);
+ assertEquals("Hello Donald Duck", reply);
+
+ EntityManager em = polledEntityManager.get();
+ assertNotNull(em, "The polled exchange should carry its EntityManager
in the CamelEntityManager header");
+ // the header must stay usable while the enriched exchange is routed
+ assertTrue(openDuringAggregation.get(), "The EntityManager should be
open while the exchange is routed");
+ // and released once the enriched exchange is done
+ assertFalse(em.isOpen(), "The EntityManager of the poll should be
closed when the exchange is done");
+ }
+
+ @Test
+ public void testConsumerTemplateClosesEntityManagerOnDoneUoW() {
+ saveCustomer("Donald Duck");
+
+ Exchange exchange = consumer.receive(QUERY_URI, 5000);
+ assertNotNull(exchange);
+ assertEquals("Donald Duck",
exchange.getIn().getBody(Customer.class).getName());
+
+ EntityManager em =
exchange.getIn().getHeader(JpaConstants.ENTITY_MANAGER, EntityManager.class);
+ assertNotNull(em);
+ assertTrue(em.isOpen(), "The EntityManager should stay open until the
caller is done with the exchange");
+
+ consumer.doneUoW(exchange);
+
+ assertFalse(em.isOpen(), "doneUoW should close the EntityManager of
the poll");
+ }
+
+ @Test
+ public void testPollEnrichDoesNotLeakEntityManagerPropertyToTheRoute() {
+ saveCustomer("Donald Duck");
+
+ template.sendBody("direct:defaultStrategy", "Hello");
+
+ // the default pollEnrich strategy copies the properties of the polled
exchange: a later jpa producer
+ // would reuse the EntityManager of the poll instead of its own if the
property were set
+ assertNull(propertyAfterPollEnrich.get(), "The polled EntityManager
must not be exposed as an exchange property");
+ }
+
+ @Test
+ public void testFailedPollClosesEntityManager() throws Exception {
+ AtomicReference<EntityManager> created = new AtomicReference<>();
+
+ JpaEndpoint endpoint = context.getEndpoint("jpa:" +
Customer.class.getName(), JpaEndpoint.class);
+ JpaPollingConsumer polling = (JpaPollingConsumer)
endpoint.createPollingConsumer();
+ polling.setQueryFactory(em -> {
+ created.set(em);
+ throw new IllegalArgumentException("Invalid query");
+ });
+ polling.start();
+ try {
+ assertThrows(IllegalArgumentException.class, polling::receive);
+ } finally {
+ polling.stop();
+ }
+
+ EntityManager em = created.get();
+ assertNotNull(em);
+ // the exchange is never returned to the caller, so nobody else can
close the EntityManager
+ assertFalse(em.isOpen(), "The EntityManager must be closed when the
poll fails");
+ }
+
+ private void saveCustomer(String name) {
+ Customer customer = new Customer();
+ customer.setName(name);
+ saveEntityInDB(customer);
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ public void configure() {
+ from("direct:defaultStrategy")
+ .pollEnrich(QUERY_URI, 5000)
+ .process(exchange ->
propertyAfterPollEnrich.set(exchange.getProperty(JpaConstants.ENTITY_MANAGER)));
+
+ from("direct:start")
+ .pollEnrich(QUERY_URI, 5000, (original, polled) -> {
+ EntityManager em =
polled.getIn().getHeader(JpaConstants.ENTITY_MANAGER, EntityManager.class);
+ polledEntityManager.set(em);
+ openDuringAggregation.set(em != null &&
em.isOpen());
+ String name =
polled.getIn().getBody(Customer.class).getName();
+
original.getIn().setBody(original.getIn().getBody(String.class) + " " + name);
+ return original;
+ });
+ }
+ };
+ }
+
+ @Override
+ protected String routeXml() {
+ return "org/apache/camel/processor/jpa/springJpaRouteTest.xml";
+ }
+
+ @Override
+ protected String selectAllString() {
+ return SELECT_ALL_STRING;
+ }
+}
diff --git
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_25.adoc
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_25.adoc
index 52dba94c1356..a3638dcc0c47 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_25.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_25.adoc
@@ -615,7 +615,6 @@ ignored them. Now these two options ignore a disabled
source too: for example `C
no longer turns on virtual threads when the OS environment variables are
disabled. Set the option in
`application.properties` instead, or enable the source again.
-
=== camel-sql and camel-sql-stored - usePlaceholder, maxRows, outputHeader and
batch expressions
The `usePlaceholder` option of a `sql` endpoint now applies to the query in
the URI and to the `onConsume`,
@@ -636,3 +635,20 @@ header is `true`, into the `CamelSqlGeneratedKeyRows` and
`CamelSqlGeneratedKeys
With `batch=true`, the `sql-stored` producer now evaluates a simple expression
of an IN parameter (such as
`+${body[num]}+`) with the batch item as the message body, as `:#name` already
did. Before, `+${body}+` referred to the
whole message body, so every item got the same value.
+
+=== camel-jpa - an unknown entityType fails the endpoint, and the polling
consumer closes its EntityManager
+
+The entity class in the path of a `jpa` endpoint (`jpa:com.foo.MyEntity`) must
now be a class that Camel can load, or
+an alias from the `aliases` component option. Before, a class name that could
not be loaded was ignored and the
+endpoint had no `entityType`, so the producer stored the message body without
converting it and the consumer failed
+later with `No queryType property configured`. Creating the endpoint now fails
with a `ResolveEndpointFailedException`
+caused by a `ClassNotFoundException`. Check for a misspelled class name, and
for query parameters appended without a
+`?` (such as `jpa:com.foo.MyEntity&entityType=java.util.List`), which end up
in the class name.
+
+`entityType` and `persistenceUnit` are no longer marked as required in the
catalog: the producer works without an
+entity class (for example with a `query`), and `persistenceUnit` defaults to
`camel`.
+
+The polling consumer (`pollEnrich`, or `receive` of a `ConsumerTemplate`) now
closes the EntityManager it creates when
+the polled exchange is done, instead of leaving it open. With `pollEnrich`
this happens when the enriched exchange
+completes. With a `ConsumerTemplate`, call `doneUoW(exchange)` when you are
done with the received exchange, as for any
+other polled endpoint.
diff --git
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java
index a471837d7405..3ed0405969d1 100644
---
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java
+++
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java
@@ -11067,7 +11067,7 @@ public class StaticEndpointBuilders {
*
* Syntax: <code>jpa:entityType</code>
*
- * Path parameter: entityType (required)
+ * Path parameter: entityType
* The entity class: its fully qualified class name, or an alias from the
* aliases component option. The consumer polls the entities of this class
* when no query is set, the producer converts the message body to it, and
@@ -11090,7 +11090,7 @@ public class StaticEndpointBuilders {
*
* Syntax: <code>jpa:entityType</code>
*
- * Path parameter: entityType (required)
+ * Path parameter: entityType
* The entity class: its fully qualified class name, or an alias from the
* aliases component option. The consumer polls the entities of this class
* when no query is set, the producer converts the message body to it, and
diff --git
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/JpaEndpointBuilderFactory.java
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/JpaEndpointBuilderFactory.java
index db04937e2ac9..b567397e2638 100644
---
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/JpaEndpointBuilderFactory.java
+++
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/JpaEndpointBuilderFactory.java
@@ -192,7 +192,6 @@ public interface JpaEndpointBuilderFactory {
*
* The option is a: <code>java.lang.String</code> type.
*
- * Required: true
* Default: camel
* Group: common
*
@@ -1577,7 +1576,6 @@ public interface JpaEndpointBuilderFactory {
*
* The option is a: <code>java.lang.String</code> type.
*
- * Required: true
* Default: camel
* Group: common
*
@@ -2247,7 +2245,6 @@ public interface JpaEndpointBuilderFactory {
*
* The option is a: <code>java.lang.String</code> type.
*
- * Required: true
* Default: camel
* Group: common
*
@@ -2436,7 +2433,7 @@ public interface JpaEndpointBuilderFactory {
*
* Syntax: <code>jpa:entityType</code>
*
- * Path parameter: entityType (required)
+ * Path parameter: entityType
* The entity class: its fully qualified class name, or an alias from
* the aliases component option. The consumer polls the entities of
this
* class when no query is set, the producer converts the message body
to
@@ -2459,7 +2456,7 @@ public interface JpaEndpointBuilderFactory {
*
* Syntax: <code>jpa:entityType</code>
*
- * Path parameter: entityType (required)
+ * Path parameter: entityType
* The entity class: its fully qualified class name, or an alias from
* the aliases component option. The consumer polls the entities of
this
* class when no query is set, the producer converts the message body
to
@@ -2516,7 +2513,7 @@ public interface JpaEndpointBuilderFactory {
* Defines the maximum number of results to retrieve on the query;
takes
* precedence over the value set on the endpoint, if any.
*
- * The option is a: {@code } type.
+ * The option is a: {@code java.lang.Integer} type.
*
* Group: producer
*
@@ -2529,7 +2526,7 @@ public interface JpaEndpointBuilderFactory {
* Defines the position of the first result to retrieve; takes
* precedence over the value set on the endpoint, if any.
*
- * The option is a: {@code } type.
+ * The option is a: {@code java.lang.Integer} type.
*
* Group: producer
*