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
commit 71fd27023ee186edb10c471f7120a6dfd236ed59 Author: Claus Ibsen <[email protected]> AuthorDate: Fri Nov 27 17:06:06 2026 +0100 CAMEL-23832: camel-hibernate - improve the component and option descriptions This commit rewrites the component description, the texts of 4 component options, 12 endpoint options and 1 header of hibernate. The new texts say which side reads each option, what the producer sets as the body, and when the component options apply (only when the component bootstraps the SessionFactory). The old component description left out the stateless insert and upsert and the consumer. Documentation only, no behavior change. The component JSON, the catalog copy, the doc page header and the DSL are regenerated. camel-hibernate is marked as done in tasks/component-descriptions.md. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Claus Ibsen <[email protected]> --- .../apache/camel/catalog/components/hibernate.json | 36 ++-- .../camel/catalog/docs/hibernate-component.adoc | 2 +- .../camel/component/hibernate/hibernate.json | 36 ++-- .../src/main/docs/hibernate-component.adoc | 2 +- .../component/hibernate/HibernateComponent.java | 15 +- .../component/hibernate/HibernateConstants.java | 4 +- .../component/hibernate/HibernateEndpoint.java | 53 ++++-- .../component/ComponentsBuilderFactory.java | 4 +- .../dsl/HibernateComponentBuilderFactory.java | 29 ++- .../builder/endpoint/EndpointHeaderBuilders.java | 4 +- .../builder/endpoint/StaticEndpointBuilders.java | 16 +- .../dsl/HibernateEndpointBuilderFactory.java | 202 ++++++++++++++------- tasks/component-descriptions.md | 2 +- 13 files changed, 267 insertions(+), 138 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/hibernate.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/hibernate.json index c98ec121a8be..5d761de48247 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/hibernate.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/hibernate.json @@ -3,7 +3,7 @@ "kind": "component", "name": "hibernate", "title": "Hibernate", - "description": "Execute selection and mutation queries and natural-id lookups using Hibernate ORM.", + "description": "Run HQL queries, look up, insert and upsert entities, and poll entities from a relational database with Hibernate ORM.", "deprecated": false, "firstVersion": "4.24.0", "label": "database", @@ -24,16 +24,16 @@ "remote": true }, "componentProperties": { - "dataSource": { "index": 0, "kind": "property", "displayName": "Data Source", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "description": "The DataSource to use for bootstrapping the SessionFactory (bean reference or registry name)." }, - "hibernateProperties": { "index": 1, "kind": "property", "displayName": "Hibernate Properties", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "deprecated": false, "autowired": false, "secret": false, "description": "Arbitrary Hibernate configuration properties passthrough map." }, - "schemaAction": { "index": 2, "kind": "property", "displayName": "Schema Action", "group": "common", "label": "", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "none", "validate", "update", "create", "create-drop", "create-only", "drop" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "none", "description": "Schema generation action: none, validate, update, create, create-drop, create-only, drop." }, - "sessionFactory": { "index": 3, "kind": "property", "displayName": "Session Factory", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.hibernate.SessionFactory", "deprecated": false, "autowired": false, "secret": false, "description": "The Hibernate SessionFactory to use." }, + "dataSource": { "index": 0, "kind": "property", "displayName": "Data Source", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "description": "The DataSource, or the name of a DataSource bean in the registry, that the component uses when it bootstraps the SessionFactory. If not set, the single DataSource in the registry is used. It is ignored if hibernateProperties set jakart [...] + "hibernateProperties": { "index": 1, "kind": "property", "displayName": "Hibernate Properties", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "deprecated": false, "autowired": false, "secret": false, "description": "Hibernate configuration properties, such as hibernate.show_sql, that the component passes to Hibernate when it bootstraps the SessionFactory." }, + "schemaAction": { "index": 2, "kind": "property", "displayName": "Schema Action", "group": "common", "label": "", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "none", "validate", "update", "create", "create-drop", "create-only", "drop" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "none", "description": "The schema management action (hibernate.hbm2ddl.auto) when the component bootstraps the SessionFactory. The default non [...] + "sessionFactory": { "index": 3, "kind": "property", "displayName": "Session Factory", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.hibernate.SessionFactory", "deprecated": false, "autowired": false, "secret": false, "description": "The Hibernate SessionFactory for all endpoints. If not set, the single SessionFactory in the registry is used, otherwise the component bootstraps one. The component does not close a SessionFactory that it did not cr [...] "bridgeErrorHandler": { "index": 4, "kind": "property", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the like [...] "lazyStartProducer": { "index": 5, "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "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 [...] "autowiredEnabled": { "index": 6, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "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 t [...] }, "headers": { - "CamelHibernateParameters": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Map<String, Object>", "deprecated": false, "autowired": false, "secret": false, "description": "Map of named parameters to bind to the Hibernate query, or to override natural-id lookup values.", "constantName": "org.apache.camel.component.hibernate.HibernateConstants#HIBERNATE_PARAMETERS" } + "CamelHibernateParameters": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Map<String, Object>", "deprecated": false, "autowired": false, "secret": false, "description": "The named parameters, as a Map, that the producer binds to the selection or mutation query. For a natural-id lookup the entries are added to the naturalId values and replace those of the same name. The values are not evaluated as expressio [...] }, "bodyTypes": { "consumerOut": { "carriers": [ "pojo" ], "javaTypeOption": "entityClassName", "description": "The configured selection query emits one entity per message." }, @@ -41,23 +41,23 @@ "producerOut": { "carriers": [ "pojo", "list", "value", "null", "unchanged" ], "byOption": [ { "option": "streaming", "value": "true", "carriers": [ "iterator" ] } ], "description": "The result depends on the operation: a selection query returns a list, or a java.util.stream.Stream when streaming=true; a mutation query returns the affected-row count; a natural-id lookup returns the entity or null; stateless operations leave the body unchanged." } }, "properties": { - "entityClassName": { "index": 0, "kind": "path", "displayName": "Entity Class Name", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Target entity class name" }, - "filters": { "index": 1, "kind": "parameter", "displayName": "Filters", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.util.Map<java.lang.String, java.lang.Object>>", "prefix": "filter.", "multiValue": true, "deprecated": false, "autowired": false, "secret": false, "description": "Hibernate filters and their parameter values. This is a multi-value option with prefix: filter." }, - "readOnly": { "index": 2, "kind": "parameter", "displayName": "Read Only", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the Hibernate session and selection query should be read-only." }, - "selectionQuery": { "index": 3, "kind": "parameter", "displayName": "Selection Query", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The HQL selection query to execute." }, - "tenantIdentifier": { "index": 4, "kind": "parameter", "displayName": "Tenant Identifier", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The tenant identifier used to create the Hibernate session." }, - "consumeDelete": { "index": 5, "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 to delete consumed entities after successful processing." }, - "maximumResults": { "index": 6, "kind": "parameter", "displayName": "Maximum Results", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "description": "The maximum number of entities to retrieve in a single poll." }, + "entityClassName": { "index": 0, "kind": "path", "displayName": "Entity Class Name", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The fully qualified class name of the Hibernate entity. It is the result type of the selection query and the entity type of the natural-id lookup. The mutation query and the stateless operations do not use it." }, + "filters": { "index": 1, "kind": "parameter", "displayName": "Filters", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.util.Map<java.lang.String, java.lang.Object>>", "prefix": "filter.", "multiValue": true, "deprecated": false, "autowired": false, "secret": false, "description": "The Hibernate filters to enable on the session, with their parameter values, for example filter.tenantFilter.tenantId=tenant-a. Values [...] + "readOnly": { "index": 2, "kind": "parameter", "displayName": "Read Only", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to run the selection query read-only, so that Hibernate does not track changes of the loaded entities. The session that the component opens is read-only by default too. Other operations are not affected." }, + "selectionQuery": { "index": 3, "kind": "parameter", "displayName": "Selection Query", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The HQL selection query, for example from MyEntity where status = :status. The consumer runs it on each poll and routes one message per entity. The producer sets the result list as the body, and binds the named parameters from [...] + "tenantIdentifier": { "index": 4, "kind": "parameter", "displayName": "Tenant Identifier", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The tenant identifier of the Hibernate sessions that the consumer and the producer open, for a multi-tenant SessionFactory. If not set, the session uses no tenant identifier." }, + "consumeDelete": { "index": 5, "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 after it is processed successfully. The deletes are committed with the poll transaction. If false, the selection query must exclude processed entities, otherwise t [...] + "maximumResults": { "index": 6, "kind": "parameter", "displayName": "Maximum Results", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "description": "The maximum number of entities that the consumer selects in one poll. The default 0 means no limit." }, "sendEmptyMessageWhenIdle": { "index": 7, "kind": "parameter", "displayName": "Send Empty Message When Idle", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "If the polling consumer did not poll any files, you can enable this option to send an empty message (no body) instead." }, - "skipLocked": { "index": 8, "kind": "parameter", "displayName": "Skip Locked", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the consumer should skip rows that are already locked by another consumer." }, + "skipLocked": { "index": 8, "kind": "parameter", "displayName": "Skip Locked", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the consumer locks the selected rows with a pessimistic write lock and skips rows that another transaction has locked (SKIP LOCKED), so that several consumers can poll the same table. The database and [...] "bridgeErrorHandler": { "index": 9, "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming [...] "exceptionHandler": { "index": 10, "kind": "parameter", "displayName": "Exception Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", "deprecated": false, "autowired": false, "secret": false, "description": "To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By de [...] "exchangePattern": { "index": 11, "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "enum", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." }, "pollStrategy": { "index": 12, "kind": "parameter", "displayName": "Poll Strategy", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.PollingConsumerPollStrategy", "deprecated": false, "autowired": false, "secret": false, "description": "A pluggable org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your custom implementation to control error handling usually occurred during the po [...] - "mutationQuery": { "index": 13, "kind": "parameter", "displayName": "Mutation Query", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The HQL mutation query to execute." }, - "naturalIdParameters": { "index": 14, "kind": "parameter", "displayName": "Natural Id Parameters", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "prefix": "naturalId.", "multiValue": true, "deprecated": false, "autowired": false, "secret": false, "supportSimpleExpression": true, "description": "The natural-id property values used for lookup. String values can use Simple expressions from [...] - "statelessOperation": { "index": 15, "kind": "parameter", "displayName": "Stateless Operation", "group": "producer", "label": "producer", "required": false, "type": "enum", "javaType": "org.apache.camel.component.hibernate.HibernateEndpoint.StatelessOperation", "enum": [ "INSERT", "UPSERT" ], "deprecated": false, "autowired": false, "secret": false, "description": "Stateless operation to perform: insert or upsert." }, - "streaming": { "index": 16, "kind": "parameter", "displayName": "Streaming", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether selection query results should be returned as a stream." }, + "mutationQuery": { "index": 13, "kind": "parameter", "displayName": "Mutation Query", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The HQL update, delete or insert statement that the producer executes. The named parameters are bound from the CamelHibernateParameters header, and the body is set to the number of affected rows." }, + "naturalIdParameters": { "index": 14, "kind": "parameter", "displayName": "Natural Id Parameters", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "prefix": "naturalId.", "multiValue": true, "deprecated": false, "autowired": false, "secret": false, "supportSimpleExpression": true, "description": "The values of the natural-id attributes for a lookup by natural id, keyed by attribute name, f [...] + "statelessOperation": { "index": 15, "kind": "parameter", "displayName": "Stateless Operation", "group": "producer", "label": "producer", "required": false, "type": "enum", "javaType": "org.apache.camel.component.hibernate.HibernateEndpoint.StatelessOperation", "enum": [ "INSERT", "UPSERT" ], "deprecated": false, "autowired": false, "secret": false, "description": "Insert or upsert the entity of the message body with a Hibernate StatelessSession, in its own transaction. The body is l [...] + "streaming": { "index": 16, "kind": "parameter", "displayName": "Streaming", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer sets the result of the selection query as a java.util.stream.Stream instead of a List. A session that the producer opens stays open until the stream is closed or the exchange completes. The [...] "lazyStartProducer": { "index": 17, "kind": "parameter", "displayName": "Lazy Start Producer", "group": "producer (advanced)", "label": "producer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "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 produ [...] "backoffErrorThreshold": { "index": 18, "kind": "parameter", "displayName": "Backoff Error Threshold", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "description": "The number of subsequent error polls (failed due some error) that should happen before the backoffMultipler should kick-in." }, "backoffIdleThreshold": { "index": 19, "kind": "parameter", "displayName": "Backoff Idle Threshold", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "description": "The number of subsequent idle polls that should happen before the backoffMultipler should kick-in." }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/hibernate-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/hibernate-component.adoc index 1e39d21cba04..4820b6c080a3 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/hibernate-component.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/hibernate-component.adoc @@ -2,7 +2,7 @@ :doctitle: Hibernate :shortname: hibernate :artifactid: camel-hibernate -:description: Execute selection and mutation queries and natural-id lookups using Hibernate ORM. +:description: Run HQL queries, look up, insert and upsert entities, and poll entities from a relational database with Hibernate ORM. :since: 4.24 :supportlevel: Preview :tabs-sync-option: diff --git a/components/camel-hibernate/src/generated/resources/META-INF/org/apache/camel/component/hibernate/hibernate.json b/components/camel-hibernate/src/generated/resources/META-INF/org/apache/camel/component/hibernate/hibernate.json index c98ec121a8be..5d761de48247 100644 --- a/components/camel-hibernate/src/generated/resources/META-INF/org/apache/camel/component/hibernate/hibernate.json +++ b/components/camel-hibernate/src/generated/resources/META-INF/org/apache/camel/component/hibernate/hibernate.json @@ -3,7 +3,7 @@ "kind": "component", "name": "hibernate", "title": "Hibernate", - "description": "Execute selection and mutation queries and natural-id lookups using Hibernate ORM.", + "description": "Run HQL queries, look up, insert and upsert entities, and poll entities from a relational database with Hibernate ORM.", "deprecated": false, "firstVersion": "4.24.0", "label": "database", @@ -24,16 +24,16 @@ "remote": true }, "componentProperties": { - "dataSource": { "index": 0, "kind": "property", "displayName": "Data Source", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "description": "The DataSource to use for bootstrapping the SessionFactory (bean reference or registry name)." }, - "hibernateProperties": { "index": 1, "kind": "property", "displayName": "Hibernate Properties", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "deprecated": false, "autowired": false, "secret": false, "description": "Arbitrary Hibernate configuration properties passthrough map." }, - "schemaAction": { "index": 2, "kind": "property", "displayName": "Schema Action", "group": "common", "label": "", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "none", "validate", "update", "create", "create-drop", "create-only", "drop" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "none", "description": "Schema generation action: none, validate, update, create, create-drop, create-only, drop." }, - "sessionFactory": { "index": 3, "kind": "property", "displayName": "Session Factory", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.hibernate.SessionFactory", "deprecated": false, "autowired": false, "secret": false, "description": "The Hibernate SessionFactory to use." }, + "dataSource": { "index": 0, "kind": "property", "displayName": "Data Source", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "description": "The DataSource, or the name of a DataSource bean in the registry, that the component uses when it bootstraps the SessionFactory. If not set, the single DataSource in the registry is used. It is ignored if hibernateProperties set jakart [...] + "hibernateProperties": { "index": 1, "kind": "property", "displayName": "Hibernate Properties", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "deprecated": false, "autowired": false, "secret": false, "description": "Hibernate configuration properties, such as hibernate.show_sql, that the component passes to Hibernate when it bootstraps the SessionFactory." }, + "schemaAction": { "index": 2, "kind": "property", "displayName": "Schema Action", "group": "common", "label": "", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "none", "validate", "update", "create", "create-drop", "create-only", "drop" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "none", "description": "The schema management action (hibernate.hbm2ddl.auto) when the component bootstraps the SessionFactory. The default non [...] + "sessionFactory": { "index": 3, "kind": "property", "displayName": "Session Factory", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.hibernate.SessionFactory", "deprecated": false, "autowired": false, "secret": false, "description": "The Hibernate SessionFactory for all endpoints. If not set, the single SessionFactory in the registry is used, otherwise the component bootstraps one. The component does not close a SessionFactory that it did not cr [...] "bridgeErrorHandler": { "index": 4, "kind": "property", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the like [...] "lazyStartProducer": { "index": 5, "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "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 [...] "autowiredEnabled": { "index": 6, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "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 t [...] }, "headers": { - "CamelHibernateParameters": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Map<String, Object>", "deprecated": false, "autowired": false, "secret": false, "description": "Map of named parameters to bind to the Hibernate query, or to override natural-id lookup values.", "constantName": "org.apache.camel.component.hibernate.HibernateConstants#HIBERNATE_PARAMETERS" } + "CamelHibernateParameters": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Map<String, Object>", "deprecated": false, "autowired": false, "secret": false, "description": "The named parameters, as a Map, that the producer binds to the selection or mutation query. For a natural-id lookup the entries are added to the naturalId values and replace those of the same name. The values are not evaluated as expressio [...] }, "bodyTypes": { "consumerOut": { "carriers": [ "pojo" ], "javaTypeOption": "entityClassName", "description": "The configured selection query emits one entity per message." }, @@ -41,23 +41,23 @@ "producerOut": { "carriers": [ "pojo", "list", "value", "null", "unchanged" ], "byOption": [ { "option": "streaming", "value": "true", "carriers": [ "iterator" ] } ], "description": "The result depends on the operation: a selection query returns a list, or a java.util.stream.Stream when streaming=true; a mutation query returns the affected-row count; a natural-id lookup returns the entity or null; stateless operations leave the body unchanged." } }, "properties": { - "entityClassName": { "index": 0, "kind": "path", "displayName": "Entity Class Name", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Target entity class name" }, - "filters": { "index": 1, "kind": "parameter", "displayName": "Filters", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.util.Map<java.lang.String, java.lang.Object>>", "prefix": "filter.", "multiValue": true, "deprecated": false, "autowired": false, "secret": false, "description": "Hibernate filters and their parameter values. This is a multi-value option with prefix: filter." }, - "readOnly": { "index": 2, "kind": "parameter", "displayName": "Read Only", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the Hibernate session and selection query should be read-only." }, - "selectionQuery": { "index": 3, "kind": "parameter", "displayName": "Selection Query", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The HQL selection query to execute." }, - "tenantIdentifier": { "index": 4, "kind": "parameter", "displayName": "Tenant Identifier", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The tenant identifier used to create the Hibernate session." }, - "consumeDelete": { "index": 5, "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 to delete consumed entities after successful processing." }, - "maximumResults": { "index": 6, "kind": "parameter", "displayName": "Maximum Results", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "description": "The maximum number of entities to retrieve in a single poll." }, + "entityClassName": { "index": 0, "kind": "path", "displayName": "Entity Class Name", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The fully qualified class name of the Hibernate entity. It is the result type of the selection query and the entity type of the natural-id lookup. The mutation query and the stateless operations do not use it." }, + "filters": { "index": 1, "kind": "parameter", "displayName": "Filters", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.util.Map<java.lang.String, java.lang.Object>>", "prefix": "filter.", "multiValue": true, "deprecated": false, "autowired": false, "secret": false, "description": "The Hibernate filters to enable on the session, with their parameter values, for example filter.tenantFilter.tenantId=tenant-a. Values [...] + "readOnly": { "index": 2, "kind": "parameter", "displayName": "Read Only", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to run the selection query read-only, so that Hibernate does not track changes of the loaded entities. The session that the component opens is read-only by default too. Other operations are not affected." }, + "selectionQuery": { "index": 3, "kind": "parameter", "displayName": "Selection Query", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The HQL selection query, for example from MyEntity where status = :status. The consumer runs it on each poll and routes one message per entity. The producer sets the result list as the body, and binds the named parameters from [...] + "tenantIdentifier": { "index": 4, "kind": "parameter", "displayName": "Tenant Identifier", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The tenant identifier of the Hibernate sessions that the consumer and the producer open, for a multi-tenant SessionFactory. If not set, the session uses no tenant identifier." }, + "consumeDelete": { "index": 5, "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 after it is processed successfully. The deletes are committed with the poll transaction. If false, the selection query must exclude processed entities, otherwise t [...] + "maximumResults": { "index": 6, "kind": "parameter", "displayName": "Maximum Results", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "description": "The maximum number of entities that the consumer selects in one poll. The default 0 means no limit." }, "sendEmptyMessageWhenIdle": { "index": 7, "kind": "parameter", "displayName": "Send Empty Message When Idle", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "If the polling consumer did not poll any files, you can enable this option to send an empty message (no body) instead." }, - "skipLocked": { "index": 8, "kind": "parameter", "displayName": "Skip Locked", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the consumer should skip rows that are already locked by another consumer." }, + "skipLocked": { "index": 8, "kind": "parameter", "displayName": "Skip Locked", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the consumer locks the selected rows with a pessimistic write lock and skips rows that another transaction has locked (SKIP LOCKED), so that several consumers can poll the same table. The database and [...] "bridgeErrorHandler": { "index": 9, "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming [...] "exceptionHandler": { "index": 10, "kind": "parameter", "displayName": "Exception Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", "deprecated": false, "autowired": false, "secret": false, "description": "To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By de [...] "exchangePattern": { "index": 11, "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "enum", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." }, "pollStrategy": { "index": 12, "kind": "parameter", "displayName": "Poll Strategy", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.PollingConsumerPollStrategy", "deprecated": false, "autowired": false, "secret": false, "description": "A pluggable org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your custom implementation to control error handling usually occurred during the po [...] - "mutationQuery": { "index": 13, "kind": "parameter", "displayName": "Mutation Query", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The HQL mutation query to execute." }, - "naturalIdParameters": { "index": 14, "kind": "parameter", "displayName": "Natural Id Parameters", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "prefix": "naturalId.", "multiValue": true, "deprecated": false, "autowired": false, "secret": false, "supportSimpleExpression": true, "description": "The natural-id property values used for lookup. String values can use Simple expressions from [...] - "statelessOperation": { "index": 15, "kind": "parameter", "displayName": "Stateless Operation", "group": "producer", "label": "producer", "required": false, "type": "enum", "javaType": "org.apache.camel.component.hibernate.HibernateEndpoint.StatelessOperation", "enum": [ "INSERT", "UPSERT" ], "deprecated": false, "autowired": false, "secret": false, "description": "Stateless operation to perform: insert or upsert." }, - "streaming": { "index": 16, "kind": "parameter", "displayName": "Streaming", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether selection query results should be returned as a stream." }, + "mutationQuery": { "index": 13, "kind": "parameter", "displayName": "Mutation Query", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The HQL update, delete or insert statement that the producer executes. The named parameters are bound from the CamelHibernateParameters header, and the body is set to the number of affected rows." }, + "naturalIdParameters": { "index": 14, "kind": "parameter", "displayName": "Natural Id Parameters", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "prefix": "naturalId.", "multiValue": true, "deprecated": false, "autowired": false, "secret": false, "supportSimpleExpression": true, "description": "The values of the natural-id attributes for a lookup by natural id, keyed by attribute name, f [...] + "statelessOperation": { "index": 15, "kind": "parameter", "displayName": "Stateless Operation", "group": "producer", "label": "producer", "required": false, "type": "enum", "javaType": "org.apache.camel.component.hibernate.HibernateEndpoint.StatelessOperation", "enum": [ "INSERT", "UPSERT" ], "deprecated": false, "autowired": false, "secret": false, "description": "Insert or upsert the entity of the message body with a Hibernate StatelessSession, in its own transaction. The body is l [...] + "streaming": { "index": 16, "kind": "parameter", "displayName": "Streaming", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer sets the result of the selection query as a java.util.stream.Stream instead of a List. A session that the producer opens stays open until the stream is closed or the exchange completes. The [...] "lazyStartProducer": { "index": 17, "kind": "parameter", "displayName": "Lazy Start Producer", "group": "producer (advanced)", "label": "producer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "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 produ [...] "backoffErrorThreshold": { "index": 18, "kind": "parameter", "displayName": "Backoff Error Threshold", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "description": "The number of subsequent error polls (failed due some error) that should happen before the backoffMultipler should kick-in." }, "backoffIdleThreshold": { "index": 19, "kind": "parameter", "displayName": "Backoff Idle Threshold", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "description": "The number of subsequent idle polls that should happen before the backoffMultipler should kick-in." }, diff --git a/components/camel-hibernate/src/main/docs/hibernate-component.adoc b/components/camel-hibernate/src/main/docs/hibernate-component.adoc index 1e39d21cba04..4820b6c080a3 100644 --- a/components/camel-hibernate/src/main/docs/hibernate-component.adoc +++ b/components/camel-hibernate/src/main/docs/hibernate-component.adoc @@ -2,7 +2,7 @@ :doctitle: Hibernate :shortname: hibernate :artifactid: camel-hibernate -:description: Execute selection and mutation queries and natural-id lookups using Hibernate ORM. +:description: Run HQL queries, look up, insert and upsert entities, and poll entities from a relational database with Hibernate ORM. :since: 4.24 :supportlevel: Preview :tabs-sync-option: diff --git a/components/camel-hibernate/src/main/java/org/apache/camel/component/hibernate/HibernateComponent.java b/components/camel-hibernate/src/main/java/org/apache/camel/component/hibernate/HibernateComponent.java index 5001c82a472c..fc2ced283814 100644 --- a/components/camel-hibernate/src/main/java/org/apache/camel/component/hibernate/HibernateComponent.java +++ b/components/camel-hibernate/src/main/java/org/apache/camel/component/hibernate/HibernateComponent.java @@ -39,20 +39,27 @@ public class HibernateComponent extends DefaultComponent { private static final Logger LOG = LoggerFactory.getLogger(HibernateComponent.class); - @Metadata(description = "The Hibernate SessionFactory to use.") + @Metadata(description = "The Hibernate SessionFactory for all endpoints. If not set, the single SessionFactory in the" + + " registry is used, otherwise the component bootstraps one. The component does not close a" + + " SessionFactory that it did not create.") private SessionFactory sessionFactory; - @Metadata(description = "The DataSource to use for bootstrapping the SessionFactory (bean reference or registry name).") + @Metadata(description = "The DataSource, or the name of a DataSource bean in the registry, that the component uses when it" + + " bootstraps the SessionFactory. If not set, the single DataSource in the registry is used. It is" + + " ignored if hibernateProperties set jakarta.persistence.jtaDataSource or" + + " jakarta.persistence.nonJtaDataSource.") private Object dataSource; private Class<?>[] entityClasses; - @Metadata(description = "Schema generation action: none, validate, update, create, create-drop, create-only, drop.", + @Metadata(description = "The schema management action (hibernate.hbm2ddl.auto) when the component bootstraps the" + + " SessionFactory. The default none leaves the schema as it is.", defaultValue = "none", enums = "none,validate,update,create,create-drop,create-only,drop") private String schemaAction = "none"; - @Metadata(description = "Arbitrary Hibernate configuration properties passthrough map.") + @Metadata(description = "Hibernate configuration properties, such as hibernate.show_sql, that the component passes to" + + " Hibernate when it bootstraps the SessionFactory.") private Map<String, Object> hibernateProperties = new HashMap<>(); private boolean sessionFactoryOwned; diff --git a/components/camel-hibernate/src/main/java/org/apache/camel/component/hibernate/HibernateConstants.java b/components/camel-hibernate/src/main/java/org/apache/camel/component/hibernate/HibernateConstants.java index 9a5cb013f184..c81d8f95700a 100644 --- a/components/camel-hibernate/src/main/java/org/apache/camel/component/hibernate/HibernateConstants.java +++ b/components/camel-hibernate/src/main/java/org/apache/camel/component/hibernate/HibernateConstants.java @@ -20,7 +20,9 @@ import org.apache.camel.spi.Metadata; public final class HibernateConstants { - @Metadata(description = "Map of named parameters to bind to the Hibernate query, or to override natural-id lookup values.", + @Metadata(description = "The named parameters, as a Map, that the producer binds to the selection or mutation query. For" + + " a natural-id lookup the entries are added to the naturalId values and replace those of the" + + " same name. The values are not evaluated as expressions.", javaType = "Map<String, Object>", label = "producer") public static final String HIBERNATE_PARAMETERS = "CamelHibernateParameters"; diff --git a/components/camel-hibernate/src/main/java/org/apache/camel/component/hibernate/HibernateEndpoint.java b/components/camel-hibernate/src/main/java/org/apache/camel/component/hibernate/HibernateEndpoint.java index acc690061b91..49eb422fca61 100644 --- a/components/camel-hibernate/src/main/java/org/apache/camel/component/hibernate/HibernateEndpoint.java +++ b/components/camel-hibernate/src/main/java/org/apache/camel/component/hibernate/HibernateEndpoint.java @@ -38,7 +38,8 @@ import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder; /** - * Execute selection and mutation queries and natural-id lookups using Hibernate ORM. + * Run HQL queries, look up, insert and upsert entities, and poll entities from a relational database with Hibernate + * ORM. */ @UriEndpoint(firstVersion = "4.24.0", scheme = "hibernate", title = "Hibernate", syntax = "hibernate:entityClassName", category = { Category.DATABASE }, headersClass = HibernateConstants.class) @@ -57,28 +58,43 @@ import org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder; description = "The result depends on the operation: a selection query returns a list, or a java.util.stream.Stream when streaming=true; a mutation query returns the affected-row count; a natural-id lookup returns the entity or null; stateless operations leave the body unchanged.")) public class HibernateEndpoint extends ScheduledPollEndpoint { - @UriPath(description = "Target entity class name") + @UriPath(description = "The fully qualified class name of the Hibernate entity. It is the result type of the selection query" + + " and the entity type of the natural-id lookup. The mutation query and the stateless operations do" + + " not use it.") @Metadata(required = true) private String entityClassName; - @UriParam(description = "The HQL selection query to execute.") + @UriParam(description = "The HQL selection query, for example from MyEntity where status = :status. The consumer runs it on" + + " each poll and routes one message per entity. The producer sets the result list as the body, and" + + " binds the named parameters from the CamelHibernateParameters header.") private String selectionQuery; - @UriParam(description = "The HQL mutation query to execute.", label = "producer") + @UriParam(description = "The HQL update, delete or insert statement that the producer executes. The named parameters are" + + " bound from the CamelHibernateParameters header, and the body is set to the number of affected" + + " rows.", + label = "producer") private String mutationQuery; - @UriParam(description = "The natural-id property values used for lookup. String values can use Simple expressions from the message.", + @UriParam(description = "The values of the natural-id attributes for a lookup by natural id, keyed by attribute name, for" + + " example naturalId.email=${header.email}. String values are evaluated as Simple expressions." + + " Entries of the CamelHibernateParameters header are added and replace values of the same name.", label = "producer", prefix = "naturalId.", multiValue = true) @Metadata(supportSimpleExpression = true) private Map<String, Object> naturalIdParameters; - @UriParam(description = "Whether the Hibernate session and selection query should be read-only.") + @UriParam(description = "Whether to run the selection query read-only, so that Hibernate does not track changes of the" + + " loaded entities. The session that the component opens is read-only by default too. Other" + + " operations are not affected.") private boolean readOnly; - @UriParam(description = "Hibernate filters and their parameter values.", prefix = "filter.", multiValue = true) + @UriParam(description = "The Hibernate filters to enable on the session, with their parameter values, for example" + + " filter.tenantFilter.tenantId=tenant-a. Values from the URI are strings; a #bean reference" + + " passes another type. The stateless operations do not use filters.", + prefix = "filter.", multiValue = true) private Map<String, Map<String, Object>> filters; - @UriParam(description = "The tenant identifier used to create the Hibernate session.") + @UriParam(description = "The tenant identifier of the Hibernate sessions that the consumer and the producer open, for a" + + " multi-tenant SessionFactory. If not set, the session uses no tenant identifier.") private String tenantIdentifier; public enum StatelessOperation { @@ -86,20 +102,31 @@ public class HibernateEndpoint extends ScheduledPollEndpoint { UPSERT } - @UriParam(description = "Stateless operation to perform: insert or upsert.", label = "producer") + @UriParam(description = "Insert or upsert the entity of the message body with a Hibernate StatelessSession, in its own" + + " transaction. The body is left unchanged.", + label = "producer") private StatelessOperation statelessOperation; - @UriParam(description = "Whether selection query results should be returned as a stream.", label = "producer") + @UriParam(description = "Whether the producer sets the result of the selection query as a java.util.stream.Stream instead" + + " of a List. A session that the producer opens stays open until the stream is closed or the" + + " exchange completes. The producer fails in a transacted exchange.", + label = "producer") private boolean streaming; - @UriParam(description = "Whether the consumer should skip rows that are already locked by another consumer.", + @UriParam(description = "Whether the consumer locks the selected rows with a pessimistic write lock and skips rows that" + + " another transaction has locked (SKIP LOCKED), so that several consumers can poll the same" + + " table. The database and its Hibernate dialect must support it.", label = "consumer") private boolean skipLocked; - @UriParam(description = "The maximum number of entities to retrieve in a single poll.", label = "consumer") + @UriParam(description = "The maximum number of entities that the consumer selects in one poll. The default 0 means no" + + " limit.", + label = "consumer") private int maximumResults; - @UriParam(description = "Whether to delete consumed entities after successful processing.", + @UriParam(description = "Whether the consumer deletes each entity after it is processed successfully. The deletes are" + + " committed with the poll transaction. If false, the selection query must exclude processed" + + " entities, otherwise they are consumed again in the next poll.", label = "consumer", defaultValue = "true") private boolean consumeDelete = true; diff --git a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java index 2d3d41c96b02..452d584d5e4d 100644 --- a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java +++ b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java @@ -2436,8 +2436,8 @@ public interface ComponentsBuilderFactory { } /** * Hibernate (camel-hibernate) - * Execute selection and mutation queries and natural-id lookups using - * Hibernate ORM. + * Run HQL queries, look up, insert and upsert entities, and poll entities + * from a relational database with Hibernate ORM. * * Category: database * Since: 4.24 diff --git a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/HibernateComponentBuilderFactory.java b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/HibernateComponentBuilderFactory.java index 17f076231fce..a32eb85034fc 100644 --- a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/HibernateComponentBuilderFactory.java +++ b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/HibernateComponentBuilderFactory.java @@ -24,8 +24,8 @@ import org.apache.camel.builder.component.ComponentBuilder; import org.apache.camel.component.hibernate.HibernateComponent; /** - * Execute selection and mutation queries and natural-id lookups using Hibernate - * ORM. + * Run HQL queries, look up, insert and upsert entities, and poll entities from + * a relational database with Hibernate ORM. * * Generated by camel build tools - do NOT edit this file! */ @@ -34,8 +34,8 @@ public interface HibernateComponentBuilderFactory { /** * Hibernate (camel-hibernate) - * Execute selection and mutation queries and natural-id lookups using - * Hibernate ORM. + * Run HQL queries, look up, insert and upsert entities, and poll entities + * from a relational database with Hibernate ORM. * * Category: database * Since: 4.24 @@ -53,8 +53,11 @@ public interface HibernateComponentBuilderFactory { interface HibernateComponentBuilder extends ComponentBuilder<HibernateComponent> { /** - * The DataSource to use for bootstrapping the SessionFactory (bean - * reference or registry name). + * The DataSource, or the name of a DataSource bean in the registry, + * that the component uses when it bootstraps the SessionFactory. If not + * set, the single DataSource in the registry is used. It is ignored if + * hibernateProperties set jakarta.persistence.jtaDataSource or + * jakarta.persistence.nonJtaDataSource. * * The option is a: <code>java.lang.Object</code> type. * @@ -69,7 +72,9 @@ public interface HibernateComponentBuilderFactory { } /** - * Arbitrary Hibernate configuration properties passthrough map. + * Hibernate configuration properties, such as hibernate.show_sql, that + * the component passes to Hibernate when it bootstraps the + * SessionFactory. * * The option is a: <code>java.util.Map&lt;java.lang.String, * java.lang.Object&gt;</code> type. @@ -86,8 +91,9 @@ public interface HibernateComponentBuilderFactory { /** - * Schema generation action: none, validate, update, create, - * create-drop, create-only, drop. + * The schema management action (hibernate.hbm2ddl.auto) when the + * component bootstraps the SessionFactory. The default none leaves the + * schema as it is. * * The option is a: <code>java.lang.String</code> type. * @@ -103,7 +109,10 @@ public interface HibernateComponentBuilderFactory { } /** - * The Hibernate SessionFactory to use. + * The Hibernate SessionFactory for all endpoints. If not set, the + * single SessionFactory in the registry is used, otherwise the + * component bootstraps one. The component does not close a + * SessionFactory that it did not create. * * The option is a: * <code>org.hibernate.SessionFactory</code> type. diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointHeaderBuilders.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointHeaderBuilders.java index 395b97f55b76..c9cb42abd833 100644 --- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointHeaderBuilders.java +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointHeaderBuilders.java @@ -1959,8 +1959,8 @@ public class EndpointHeaderBuilders { } /** * Hibernate (camel-hibernate) - * Execute selection and mutation queries and natural-id lookups using - * Hibernate ORM. + * Run HQL queries, look up, insert and upsert entities, and poll entities + * from a relational database with Hibernate ORM. * * Category: database * Since: 4.24 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 8ef7bc2e9369..19f273f2bcb8 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 @@ -8174,8 +8174,8 @@ public class StaticEndpointBuilders { } /** * Hibernate (camel-hibernate) - * Execute selection and mutation queries and natural-id lookups using - * Hibernate ORM. + * Run HQL queries, look up, insert and upsert entities, and poll entities + * from a relational database with Hibernate ORM. * * Category: database * Since: 4.24 @@ -8184,7 +8184,9 @@ public class StaticEndpointBuilders { * Syntax: <code>hibernate:entityClassName</code> * * Path parameter: entityClassName (required) - * Target entity class name + * The fully qualified class name of the Hibernate entity. It is the result + * type of the selection query and the entity type of the natural-id lookup. + * The mutation query and the stateless operations do not use it. * * @param path entityClassName * @return the dsl builder @@ -8194,8 +8196,8 @@ public class StaticEndpointBuilders { } /** * Hibernate (camel-hibernate) - * Execute selection and mutation queries and natural-id lookups using - * Hibernate ORM. + * Run HQL queries, look up, insert and upsert entities, and poll entities + * from a relational database with Hibernate ORM. * * Category: database * Since: 4.24 @@ -8204,7 +8206,9 @@ public class StaticEndpointBuilders { * Syntax: <code>hibernate:entityClassName</code> * * Path parameter: entityClassName (required) - * Target entity class name + * The fully qualified class name of the Hibernate entity. It is the result + * type of the selection query and the entity type of the natural-id lookup. + * The mutation query and the stateless operations do not use it. * * @param componentName to use a custom component name for the endpoint * instead of the default name diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/HibernateEndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/HibernateEndpointBuilderFactory.java index c78098fa0433..5828b59e0f5f 100644 --- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/HibernateEndpointBuilderFactory.java +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/HibernateEndpointBuilderFactory.java @@ -27,8 +27,8 @@ import org.apache.camel.builder.EndpointProducerBuilder; import org.apache.camel.builder.endpoint.AbstractEndpointBuilder; /** - * Execute selection and mutation queries and natural-id lookups using Hibernate - * ORM. + * Run HQL queries, look up, insert and upsert entities, and poll entities from + * a relational database with Hibernate ORM. * * Generated by camel build tools - do NOT edit this file! */ @@ -45,8 +45,11 @@ public interface HibernateEndpointBuilderFactory { return (AdvancedHibernateEndpointConsumerBuilder) this; } /** - * Hibernate filters and their parameter values. This is a multi-value - * option with prefix: filter. + * The Hibernate filters to enable on the session, with their parameter + * values, for example filter.tenantFilter.tenantId=tenant-a. Values + * from the URI are strings; a #bean reference passes another type. The + * stateless operations do not use filters. This is a multi-value option + * with prefix: filter. * * The option is a: <code>java.util.Map<java.lang.String, * java.util.Map<java.lang.String, java.lang.Object>></code> @@ -66,8 +69,11 @@ public interface HibernateEndpointBuilderFactory { return this; } /** - * Hibernate filters and their parameter values. This is a multi-value - * option with prefix: filter. + * The Hibernate filters to enable on the session, with their parameter + * values, for example filter.tenantFilter.tenantId=tenant-a. Values + * from the URI are strings; a #bean reference passes another type. The + * stateless operations do not use filters. This is a multi-value option + * with prefix: filter. * * The option is a: <code>java.util.Map<java.lang.String, * java.util.Map<java.lang.String, java.lang.Object>></code> @@ -86,8 +92,10 @@ public interface HibernateEndpointBuilderFactory { return this; } /** - * Whether the Hibernate session and selection query should be - * read-only. + * Whether to run the selection query read-only, so that Hibernate does + * not track changes of the loaded entities. The session that the + * component opens is read-only by default too. Other operations are not + * affected. * * The option is a: <code>boolean</code> type. * @@ -102,8 +110,10 @@ public interface HibernateEndpointBuilderFactory { return this; } /** - * Whether the Hibernate session and selection query should be - * read-only. + * Whether to run the selection query read-only, so that Hibernate does + * not track changes of the loaded entities. The session that the + * component opens is read-only by default too. Other operations are not + * affected. * * The option will be converted to a <code>boolean</code> type. * @@ -118,7 +128,10 @@ public interface HibernateEndpointBuilderFactory { return this; } /** - * The HQL selection query to execute. + * The HQL selection query, for example from MyEntity where status = + * :status. The consumer runs it on each poll and routes one message per + * entity. The producer sets the result list as the body, and binds the + * named parameters from the CamelHibernateParameters header. * * The option is a: <code>java.lang.String</code> type. * @@ -132,7 +145,9 @@ public interface HibernateEndpointBuilderFactory { return this; } /** - * The tenant identifier used to create the Hibernate session. + * The tenant identifier of the Hibernate sessions that the consumer and + * the producer open, for a multi-tenant SessionFactory. If not set, the + * session uses no tenant identifier. * * The option is a: <code>java.lang.String</code> type. * @@ -146,7 +161,10 @@ public interface HibernateEndpointBuilderFactory { return this; } /** - * Whether to delete consumed entities after successful processing. + * Whether the consumer deletes each entity after it is processed + * successfully. The deletes are committed with the poll transaction. If + * false, the selection query must exclude processed entities, otherwise + * they are consumed again in the next poll. * * The option is a: <code>boolean</code> type. * @@ -161,7 +179,10 @@ public interface HibernateEndpointBuilderFactory { return this; } /** - * Whether to delete consumed entities after successful processing. + * Whether the consumer deletes each entity after it is processed + * successfully. The deletes are committed with the poll transaction. If + * false, the selection query must exclude processed entities, otherwise + * they are consumed again in the next poll. * * The option will be converted to a <code>boolean</code> type. * @@ -176,7 +197,8 @@ public interface HibernateEndpointBuilderFactory { return this; } /** - * The maximum number of entities to retrieve in a single poll. + * The maximum number of entities that the consumer selects in one poll. + * The default 0 means no limit. * * The option is a: <code>int</code> type. * @@ -190,7 +212,8 @@ public interface HibernateEndpointBuilderFactory { return this; } /** - * The maximum number of entities to retrieve in a single poll. + * The maximum number of entities that the consumer selects in one poll. + * The default 0 means no limit. * * The option will be converted to a <code>int</code> type. * @@ -236,8 +259,10 @@ public interface HibernateEndpointBuilderFactory { return this; } /** - * Whether the consumer should skip rows that are already locked by - * another consumer. + * Whether the consumer locks the selected rows with a pessimistic write + * lock and skips rows that another transaction has locked (SKIP + * LOCKED), so that several consumers can poll the same table. The + * database and its Hibernate dialect must support it. * * The option is a: <code>boolean</code> type. * @@ -252,8 +277,10 @@ public interface HibernateEndpointBuilderFactory { return this; } /** - * Whether the consumer should skip rows that are already locked by - * another consumer. + * Whether the consumer locks the selected rows with a pessimistic write + * lock and skips rows that another transaction has locked (SKIP + * LOCKED), so that several consumers can poll the same table. The + * database and its Hibernate dialect must support it. * * The option will be converted to a <code>boolean</code> type. * @@ -943,8 +970,11 @@ public interface HibernateEndpointBuilderFactory { } /** - * Hibernate filters and their parameter values. This is a multi-value - * option with prefix: filter. + * The Hibernate filters to enable on the session, with their parameter + * values, for example filter.tenantFilter.tenantId=tenant-a. Values + * from the URI are strings; a #bean reference passes another type. The + * stateless operations do not use filters. This is a multi-value option + * with prefix: filter. * * The option is a: <code>java.util.Map<java.lang.String, * java.util.Map<java.lang.String, java.lang.Object>></code> @@ -964,8 +994,11 @@ public interface HibernateEndpointBuilderFactory { return this; } /** - * Hibernate filters and their parameter values. This is a multi-value - * option with prefix: filter. + * The Hibernate filters to enable on the session, with their parameter + * values, for example filter.tenantFilter.tenantId=tenant-a. Values + * from the URI are strings; a #bean reference passes another type. The + * stateless operations do not use filters. This is a multi-value option + * with prefix: filter. * * The option is a: <code>java.util.Map<java.lang.String, * java.util.Map<java.lang.String, java.lang.Object>></code> @@ -984,8 +1017,10 @@ public interface HibernateEndpointBuilderFactory { return this; } /** - * Whether the Hibernate session and selection query should be - * read-only. + * Whether to run the selection query read-only, so that Hibernate does + * not track changes of the loaded entities. The session that the + * component opens is read-only by default too. Other operations are not + * affected. * * The option is a: <code>boolean</code> type. * @@ -1000,8 +1035,10 @@ public interface HibernateEndpointBuilderFactory { return this; } /** - * Whether the Hibernate session and selection query should be - * read-only. + * Whether to run the selection query read-only, so that Hibernate does + * not track changes of the loaded entities. The session that the + * component opens is read-only by default too. Other operations are not + * affected. * * The option will be converted to a <code>boolean</code> type. * @@ -1016,7 +1053,10 @@ public interface HibernateEndpointBuilderFactory { return this; } /** - * The HQL selection query to execute. + * The HQL selection query, for example from MyEntity where status = + * :status. The consumer runs it on each poll and routes one message per + * entity. The producer sets the result list as the body, and binds the + * named parameters from the CamelHibernateParameters header. * * The option is a: <code>java.lang.String</code> type. * @@ -1030,7 +1070,9 @@ public interface HibernateEndpointBuilderFactory { return this; } /** - * The tenant identifier used to create the Hibernate session. + * The tenant identifier of the Hibernate sessions that the consumer and + * the producer open, for a multi-tenant SessionFactory. If not set, the + * session uses no tenant identifier. * * The option is a: <code>java.lang.String</code> type. * @@ -1044,7 +1086,10 @@ public interface HibernateEndpointBuilderFactory { return this; } /** - * The HQL mutation query to execute. + * The HQL update, delete or insert statement that the producer + * executes. The named parameters are bound from the + * CamelHibernateParameters header, and the body is set to the number of + * affected rows. * * The option is a: <code>java.lang.String</code> type. * @@ -1058,9 +1103,11 @@ public interface HibernateEndpointBuilderFactory { return this; } /** - * The natural-id property values used for lookup. String values can use - * Simple expressions from the message. This is a multi-value option - * with prefix: naturalId. + * The values of the natural-id attributes for a lookup by natural id, + * keyed by attribute name, for example naturalId.email=${header.email}. + * String values are evaluated as Simple expressions. Entries of the + * CamelHibernateParameters header are added and replace values of the + * same name. This is a multi-value option with prefix: naturalId. * * The option is a: <code>java.util.Map<java.lang.String, * java.lang.Object></code> type. @@ -1079,9 +1126,11 @@ public interface HibernateEndpointBuilderFactory { return this; } /** - * The natural-id property values used for lookup. String values can use - * Simple expressions from the message. This is a multi-value option - * with prefix: naturalId. + * The values of the natural-id attributes for a lookup by natural id, + * keyed by attribute name, for example naturalId.email=${header.email}. + * String values are evaluated as Simple expressions. Entries of the + * CamelHibernateParameters header are added and replace values of the + * same name. This is a multi-value option with prefix: naturalId. * * The option is a: <code>java.util.Map<java.lang.String, * java.lang.Object></code> type. @@ -1099,7 +1148,8 @@ public interface HibernateEndpointBuilderFactory { return this; } /** - * Stateless operation to perform: insert or upsert. + * Insert or upsert the entity of the message body with a Hibernate + * StatelessSession, in its own transaction. The body is left unchanged. * * The option is a: * <code>org.apache.camel.component.hibernate.HibernateEndpoint.StatelessOperation</code> type. @@ -1114,7 +1164,8 @@ public interface HibernateEndpointBuilderFactory { return this; } /** - * Stateless operation to perform: insert or upsert. + * Insert or upsert the entity of the message body with a Hibernate + * StatelessSession, in its own transaction. The body is left unchanged. * * The option will be converted to a * <code>org.apache.camel.component.hibernate.HibernateEndpoint.StatelessOperation</code> type. @@ -1129,7 +1180,10 @@ public interface HibernateEndpointBuilderFactory { return this; } /** - * Whether selection query results should be returned as a stream. + * Whether the producer sets the result of the selection query as a + * java.util.stream.Stream instead of a List. A session that the + * producer opens stays open until the stream is closed or the exchange + * completes. The producer fails in a transacted exchange. * * The option is a: <code>boolean</code> type. * @@ -1144,7 +1198,10 @@ public interface HibernateEndpointBuilderFactory { return this; } /** - * Whether selection query results should be returned as a stream. + * Whether the producer sets the result of the selection query as a + * java.util.stream.Stream instead of a List. A session that the + * producer opens stays open until the stream is closed or the exchange + * completes. The producer fails in a transacted exchange. * * The option will be converted to a <code>boolean</code> type. * @@ -1228,8 +1285,11 @@ public interface HibernateEndpointBuilderFactory { } /** - * Hibernate filters and their parameter values. This is a multi-value - * option with prefix: filter. + * The Hibernate filters to enable on the session, with their parameter + * values, for example filter.tenantFilter.tenantId=tenant-a. Values + * from the URI are strings; a #bean reference passes another type. The + * stateless operations do not use filters. This is a multi-value option + * with prefix: filter. * * The option is a: <code>java.util.Map<java.lang.String, * java.util.Map<java.lang.String, java.lang.Object>></code> @@ -1249,8 +1309,11 @@ public interface HibernateEndpointBuilderFactory { return this; } /** - * Hibernate filters and their parameter values. This is a multi-value - * option with prefix: filter. + * The Hibernate filters to enable on the session, with their parameter + * values, for example filter.tenantFilter.tenantId=tenant-a. Values + * from the URI are strings; a #bean reference passes another type. The + * stateless operations do not use filters. This is a multi-value option + * with prefix: filter. * * The option is a: <code>java.util.Map<java.lang.String, * java.util.Map<java.lang.String, java.lang.Object>></code> @@ -1269,8 +1332,10 @@ public interface HibernateEndpointBuilderFactory { return this; } /** - * Whether the Hibernate session and selection query should be - * read-only. + * Whether to run the selection query read-only, so that Hibernate does + * not track changes of the loaded entities. The session that the + * component opens is read-only by default too. Other operations are not + * affected. * * The option is a: <code>boolean</code> type. * @@ -1285,8 +1350,10 @@ public interface HibernateEndpointBuilderFactory { return this; } /** - * Whether the Hibernate session and selection query should be - * read-only. + * Whether to run the selection query read-only, so that Hibernate does + * not track changes of the loaded entities. The session that the + * component opens is read-only by default too. Other operations are not + * affected. * * The option will be converted to a <code>boolean</code> type. * @@ -1301,7 +1368,10 @@ public interface HibernateEndpointBuilderFactory { return this; } /** - * The HQL selection query to execute. + * The HQL selection query, for example from MyEntity where status = + * :status. The consumer runs it on each poll and routes one message per + * entity. The producer sets the result list as the body, and binds the + * named parameters from the CamelHibernateParameters header. * * The option is a: <code>java.lang.String</code> type. * @@ -1315,7 +1385,9 @@ public interface HibernateEndpointBuilderFactory { return this; } /** - * The tenant identifier used to create the Hibernate session. + * The tenant identifier of the Hibernate sessions that the consumer and + * the producer open, for a multi-tenant SessionFactory. If not set, the + * session uses no tenant identifier. * * The option is a: <code>java.lang.String</code> type. * @@ -1346,8 +1418,8 @@ public interface HibernateEndpointBuilderFactory { public interface HibernateBuilders { /** * Hibernate (camel-hibernate) - * Execute selection and mutation queries and natural-id lookups using - * Hibernate ORM. + * Run HQL queries, look up, insert and upsert entities, and poll + * entities from a relational database with Hibernate ORM. * * Category: database * Since: 4.24 @@ -1360,8 +1432,8 @@ public interface HibernateEndpointBuilderFactory { } /** * Hibernate (camel-hibernate) - * Execute selection and mutation queries and natural-id lookups using - * Hibernate ORM. + * Run HQL queries, look up, insert and upsert entities, and poll + * entities from a relational database with Hibernate ORM. * * Category: database * Since: 4.24 @@ -1370,7 +1442,10 @@ public interface HibernateEndpointBuilderFactory { * Syntax: <code>hibernate:entityClassName</code> * * Path parameter: entityClassName (required) - * Target entity class name + * The fully qualified class name of the Hibernate entity. It is the + * result type of the selection query and the entity type of the + * natural-id lookup. The mutation query and the stateless operations do + * not use it. * * @param path entityClassName * @return the dsl builder @@ -1380,8 +1455,8 @@ public interface HibernateEndpointBuilderFactory { } /** * Hibernate (camel-hibernate) - * Execute selection and mutation queries and natural-id lookups using - * Hibernate ORM. + * Run HQL queries, look up, insert and upsert entities, and poll + * entities from a relational database with Hibernate ORM. * * Category: database * Since: 4.24 @@ -1390,7 +1465,10 @@ public interface HibernateEndpointBuilderFactory { * Syntax: <code>hibernate:entityClassName</code> * * Path parameter: entityClassName (required) - * Target entity class name + * The fully qualified class name of the Hibernate entity. It is the + * result type of the selection query and the entity type of the + * natural-id lookup. The mutation query and the stateless operations do + * not use it. * * @param componentName to use a custom component name for the endpoint * instead of the default name @@ -1413,8 +1491,10 @@ public interface HibernateEndpointBuilderFactory { public static final HibernateHeaderNameBuilder INSTANCE = new HibernateHeaderNameBuilder(); /** - * Map of named parameters to bind to the Hibernate query, or to - * override natural-id lookup values. + * The named parameters, as a Map, that the producer binds to the + * selection or mutation query. For a natural-id lookup the entries are + * added to the naturalId values and replace those of the same name. The + * values are not evaluated as expressions. * * The option is a: {@code Map<String, Object>} type. * diff --git a/tasks/component-descriptions.md b/tasks/component-descriptions.md index 524d9751ce8f..b2a861a29af4 100644 --- a/tasks/component-descriptions.md +++ b/tasks/component-descriptions.md @@ -201,7 +201,7 @@ or removes its row. | camel-grpc | grpc | | | camel-hashicorp-vault | hashicorp-vault | | | camel-hazelcast | hazelcast-instance, hazelcast-list, hazelcast-map, hazelcast-multimap, hazelcast-pncounter, hazelcast-queue, hazelcast-replicatedmap, hazelcast-ringbuffer, hazelcast-seda, hazelcast-set, hazelcast-topic | | -| camel-hibernate | hibernate | | +| camel-hibernate | hibernate | yes | | camel-hivemq | hivemq | | | camel-http | http, https | | | camel-huaweicloud-dms | hwcloud-dms | |
