davsclaus commented on code in PR #27314:
URL: https://github.com/apache/camel/pull/27314#discussion_r4186536497


##########
catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/hibernate.json:
##########
@@ -0,0 +1,72 @@
+{
+  "component": {
+    "kind": "component",
+    "name": "hibernate",
+    "title": "Hibernate",
+    "description": "Camel Hibernate Component",
+    "deprecated": false,
+    "firstVersion": "4.23.0",
+    "label": "database",
+    "javaType": "org.apache.camel.component.hibernate.HibernateComponent",
+    "supportLevel": "Preview",
+    "groupId": "org.apache.camel",
+    "artifactId": "camel-hibernate",
+    "version": "4.23.0-SNAPSHOT",
+    "scheme": "hibernate",
+    "extendsScheme": "",
+    "syntax": "hibernate:entityClassName",
+    "async": false,
+    "api": false,
+    "consumerOnly": false,
+    "producerOnly": false,
+    "lenientProperties": false,
+    "browsable": false,
+    "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": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": "none", "description": "Schema generation 
action: none, validate, update, create." },
+    "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." },
+    "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 likes, will now be processed as a message 
and handled by the routing Error Handler. Important: This is only possible if 
the 3rd party component allows Camel to be alerted if an exception was thrown. 
Some components handle this internally only, and therefore bridgeErrorHandler 
is not possible. In other situations we may improve the Camel component to hook 
into the 3rd party component and make this possible for future releases. By 
default the consumer will use the org.apache.camel.spi.ExceptionHandler to d
 eal with exceptions, that will be logged at WARN or ERROR level and ignored." 
},
+    "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 during starting and cause the 
route to fail being started. By deferring this startup to be lazy then the 
startup failure can be handled during routing messages via Camel's routing 
error handlers. Beware that when the first message is processed then creating 
and starting the producer may take a little time and prolong the total 
processing time of the processing." },
+    "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 type, which then gets configured on 
the component. This can be used for automatic configuring JDBC data sources, 
JMS connection factories, AWS Clients, etc." }
+  },
+  "headers": {
+    "CamelHibernateParameters": { "index": 0, "kind": "header", "displayName": 
"", "group": "producer", "label": "producer", "required": false, "javaType": 
"", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": 
false, "description": "Map of named parameters to bind to the Hibernate 
query.", "constantName": 
"org.apache.camel.component.hibernate.HibernateConstants#HIBERNATE_PARAMETERS" 
},
+    "CamelHibernateSession": { "index": 1, "kind": "header", "displayName": 
"", "group": "producer", "label": "consumer,producer", "required": false, 
"javaType": "", "deprecated": false, "deprecationNote": "", "autowired": false, 
"secret": false, "description": "The Hibernate Session associated with the 
current exchange.", "constantName": 
"org.apache.camel.component.hibernate.HibernateConstants#HIBERNATE_SESSION" }

Review Comment:
   Stale: this header was removed from `HibernateConstants`, and 
`consumeDelete` is missing from this file. The component's own `hibernate.json` 
is up to date, so the catalog needs regenerating.



##########
components/camel-hibernate/pom.xml:
##########
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>components</artifactId>
+        <version>4.23.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>camel-hibernate</artifactId>
+    <packaging>jar</packaging>
+    <name>Camel :: Hibernate</name>
+    <description>Camel Hibernate Component</description>
+
+    <properties>
+        <firstVersion>4.23.0</firstVersion>
+        <label>database</label>
+        <hibernate8-version>8.0.0.Beta3</hibernate8-version>
+        
<jakarta-persistence4-api-version>4.0.0-M7</jakarta-persistence4-api-version>
+        <h2-version>2.5.252</h2-version>

Review Comment:
   The parent already defines `<h2-version>2.5.252</h2-version>` 
(`parent/pom.xml`), so redefining it here will drift on the next H2 upgrade. 
Please remove this property and keep `<version>${h2-version}</version>` on the 
dependency, as camel-jpa does.



##########
components/camel-hibernate/src/main/java/org/apache/camel/component/hibernate/HibernateSessionContext.java:
##########
@@ -0,0 +1,58 @@
+/*
+ * 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.hibernate;
+
+import org.apache.camel.SafeCopyProperty;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+
+final class HibernateSessionContext implements SafeCopyProperty {
+
+    private final Session session;
+    private final SessionFactory sessionFactory;
+    private final String tenantIdentifier;
+    private final Thread ownerThread;
+    private volatile boolean active = true;
+
+    HibernateSessionContext(Session session, SessionFactory sessionFactory, 
String tenantIdentifier) {
+        this.session = session;
+        this.sessionFactory = sessionFactory;
+        this.tenantIdentifier = tenantIdentifier;
+        this.ownerThread = Thread.currentThread();
+    }
+
+    Session getSession(SessionFactory expectedSessionFactory, String 
expectedTenantIdentifier) {
+        if (!active
+                || session == null
+                || ownerThread != Thread.currentThread()
+                || sessionFactory != expectedSessionFactory
+                || !java.util.Objects.equals(tenantIdentifier, 
expectedTenantIdentifier)) {

Review Comment:
   Please import `java.util.Objects` instead of using the fully qualified name 
(CLAUDE.md import style).
   
   ```suggestion
                   || !Objects.equals(tenantIdentifier, 
expectedTenantIdentifier)) {
   ```



##########
components/camel-hibernate/src/main/java/org/apache/camel/component/hibernate/HibernateConsumer.java:
##########
@@ -0,0 +1,129 @@
+/*
+ * 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.hibernate;
+
+import java.util.List;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.support.ScheduledPollConsumer;
+import org.hibernate.LockMode;
+import org.hibernate.Session;
+import org.hibernate.Timeouts;
+import org.hibernate.Transaction;
+import org.hibernate.query.SelectionQuery;
+
+public class HibernateConsumer extends ScheduledPollConsumer {
+
+    private final HibernateEndpoint endpoint;
+
+    public HibernateConsumer(HibernateEndpoint endpoint, Processor processor) {
+        super(endpoint, processor);
+        this.endpoint = endpoint;
+    }
+
+    @Override
+    protected int poll() throws Exception {
+        if (endpoint.getSelectionQuery() == null || 
endpoint.getSelectionQuery().isBlank()) {
+            throw new IllegalArgumentException("Hibernate consumer requires 
selectionQuery");
+        }
+
+        Session session = endpoint.getTenantIdentifier() == null
+                ? endpoint.getSessionFactory().openSession()
+                : endpoint.getSessionFactory().withOptions()
+                        .tenantIdentifier(endpoint.getTenantIdentifier())
+                        .openSession();
+
+        try (session) {
+            Transaction transaction = session.beginTransaction();
+
+            try {
+                if (endpoint.getFilters() != null) {
+                    endpoint.getFilters().forEach((filterName, parameters) -> {
+                        var filter = session.enableFilter(filterName);
+                        if (parameters != null) {
+                            parameters.forEach(filter::setParameter);
+                        }
+                    });
+                }
+
+                SelectionQuery<?> query = session.createSelectionQuery(
+                        endpoint.getSelectionQuery(), 
endpoint.getEntityType());
+
+                if (endpoint.isReadOnly()) {
+                    session.setDefaultReadOnly(true);
+                    query.setReadOnly(true);
+                }
+
+                if (endpoint.getMaximumResults() > 0) {
+                    query.setMaxResults(endpoint.getMaximumResults());
+                }
+
+                if (endpoint.isSkipLocked()) {
+                    query.setHibernateLockMode(LockMode.PESSIMISTIC_WRITE);
+                    query.setLockTimeout(Timeouts.SKIP_LOCKED);
+                }
+
+                List<?> results = query.getResultList();
+
+                for (Object result : results) {
+                    Exchange exchange = null;
+                    try {
+                        exchange = createExchange(false);
+                        exchange.getMessage().setBody(result);
+                        HibernateSessionContext sessionContext = new 
HibernateSessionContext(
+                                session,
+                                endpoint.getSessionFactory(),
+                                endpoint.getTenantIdentifier());
+
+                        exchange.getExchangeExtension().setSafeCopyProperty(
+                                HibernateConstants.HIBERNATE_SESSION_CONTEXT, 
sessionContext);
+
+                        getProcessor().process(exchange);
+
+                        if (exchange.getException() != null) {
+                            handleException(exchange.getException());
+                        } else if (endpoint.isConsumeDelete()) {
+                            session.remove(result);
+                        }
+                    } catch (Exception e) {
+                        handleException(e);
+                    } finally {
+                        if (exchange != null) {
+                            HibernateSessionContext sessionContext = 
exchange.getExchangeExtension()
+                                    .getSafeCopyProperty(
+                                            
HibernateConstants.HIBERNATE_SESSION_CONTEXT,
+                                            HibernateSessionContext.class);
+                            if (sessionContext != null) {
+                                sessionContext.invalidate();
+                            }
+                        }
+                        releaseExchange(exchange, false);
+                    }
+                }
+
+                transaction.commit();

Review Comment:
   If an exchange fails, `handleException` is called but the poll transaction 
is still committed here. Any writes the route made through the shared session 
for the failed exchange are committed too. Also, a Hibernate `Session` should 
not be used after it threw, so the deletes for the rest of the batch may be 
lost or fail at this commit. Should a failed exchange roll back (or at least 
stop sharing the session), as camel-jpa does with its per-exchange transaction 
handling?



##########
components/camel-hibernate/src/main/java/org/apache/camel/component/hibernate/HibernateSessionContext.java:
##########
@@ -0,0 +1,58 @@
+/*
+ * 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.hibernate;
+
+import org.apache.camel.SafeCopyProperty;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+
+final class HibernateSessionContext implements SafeCopyProperty {
+
+    private final Session session;
+    private final SessionFactory sessionFactory;
+    private final String tenantIdentifier;
+    private final Thread ownerThread;
+    private volatile boolean active = true;
+
+    HibernateSessionContext(Session session, SessionFactory sessionFactory, 
String tenantIdentifier) {
+        this.session = session;
+        this.sessionFactory = sessionFactory;
+        this.tenantIdentifier = tenantIdentifier;
+        this.ownerThread = Thread.currentThread();
+    }
+
+    Session getSession(SessionFactory expectedSessionFactory, String 
expectedTenantIdentifier) {
+        if (!active
+                || session == null
+                || ownerThread != Thread.currentThread()
+                || sessionFactory != expectedSessionFactory
+                || !java.util.Objects.equals(tenantIdentifier, 
expectedTenantIdentifier)) {
+            return null;
+        }
+
+        return session;
+    }
+
+    void invalidate() {
+        active = false;
+    }
+
+    @Override
+    public HibernateSessionContext safeCopy() {

Review Comment:
   `safeCopy()` drops the session. That is safe, but it means that after a 
sequential split, multicast or enrich the producer opens a new session on the 
same thread, and with `skipLocked` it can block on the lock the consumer's 
session holds again (the self-deadlock this is meant to avoid). Worth at least 
documenting, and covering with a test.



##########
dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/HibernateEndpointBuilderFactory.java:
##########
@@ -0,0 +1,1043 @@
+/* Generated by camel build tools - do NOT edit this file! */
+/*
+ * 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.builder.endpoint.dsl;
+
+import java.util.*;
+import java.util.concurrent.*;
+import java.util.function.*;
+import java.util.stream.*;
+import javax.annotation.processing.Generated;
+import org.apache.camel.builder.EndpointConsumerBuilder;
+import org.apache.camel.builder.EndpointProducerBuilder;
+import org.apache.camel.builder.endpoint.AbstractEndpointBuilder;
+
+/**
+ * Camel Hibernate Component
+ * 
+ * Generated by camel build tools - do NOT edit this file!
+ */
+@Generated("org.apache.camel.maven.packaging.EndpointDslMojo")
+public interface HibernateEndpointBuilderFactory {
+
+    /**
+     * Builder for endpoint consumers for the Hibernate component.
+     */
+    public interface HibernateEndpointConsumerBuilder
+            extends
+                EndpointConsumerBuilder {
+        default AdvancedHibernateEndpointConsumerBuilder advanced() {
+            return (AdvancedHibernateEndpointConsumerBuilder) this;
+        }
+        /**
+         * The maximum number of entities to retrieve in a single poll.
+         * 
+         * The option is a: <code>int</code> type.
+         * 
+         * Group: consumer
+         * 
+         * @param maximumResults the value to set
+         * @return the dsl builder
+         */
+        default HibernateEndpointConsumerBuilder maximumResults(int 
maximumResults) {
+            doSetProperty("maximumResults", maximumResults);
+            return this;
+        }
+        /**
+         * The maximum number of entities to retrieve in a single poll.
+         * 
+         * The option will be converted to a <code>int</code> type.
+         * 
+         * Group: consumer
+         * 
+         * @param maximumResults the value to set
+         * @return the dsl builder
+         */
+        default HibernateEndpointConsumerBuilder maximumResults(String 
maximumResults) {
+            doSetProperty("maximumResults", maximumResults);
+            return this;
+        }
+        /**
+         * If the polling consumer did not poll any files, you can enable this
+         * option to send an empty message (no body) instead.
+         * 
+         * The option is a: <code>boolean</code> type.
+         * 
+         * Default: false
+         * Group: consumer
+         * 
+         * @param sendEmptyMessageWhenIdle the value to set
+         * @return the dsl builder
+         */
+        default HibernateEndpointConsumerBuilder 
sendEmptyMessageWhenIdle(boolean sendEmptyMessageWhenIdle) {
+            doSetProperty("sendEmptyMessageWhenIdle", 
sendEmptyMessageWhenIdle);
+            return this;
+        }
+        /**
+         * If the polling consumer did not poll any files, you can enable this
+         * option to send an empty message (no body) instead.
+         * 
+         * The option will be converted to a <code>boolean</code> type.
+         * 
+         * Default: false
+         * Group: consumer
+         * 
+         * @param sendEmptyMessageWhenIdle the value to set
+         * @return the dsl builder
+         */
+        default HibernateEndpointConsumerBuilder 
sendEmptyMessageWhenIdle(String sendEmptyMessageWhenIdle) {
+            doSetProperty("sendEmptyMessageWhenIdle", 
sendEmptyMessageWhenIdle);
+            return this;
+        }
+        /**
+         * Whether the consumer should skip rows that are already locked by
+         * another consumer.
+         * 
+         * The option is a: <code>boolean</code> type.
+         * 
+         * Default: false
+         * Group: consumer
+         * 
+         * @param skipLocked the value to set
+         * @return the dsl builder
+         */
+        default HibernateEndpointConsumerBuilder skipLocked(boolean 
skipLocked) {
+            doSetProperty("skipLocked", skipLocked);
+            return this;
+        }
+        /**
+         * Whether the consumer should skip rows that are already locked by
+         * another consumer.
+         * 
+         * The option will be converted to a <code>boolean</code> type.
+         * 
+         * Default: false
+         * Group: consumer
+         * 
+         * @param skipLocked the value to set
+         * @return the dsl builder
+         */
+        default HibernateEndpointConsumerBuilder skipLocked(String skipLocked) 
{
+            doSetProperty("skipLocked", skipLocked);
+            return this;
+        }
+        /**
+         * The number of subsequent error polls (failed due some error) that
+         * should happen before the backoffMultipler should kick-in.
+         * 
+         * The option is a: <code>int</code> type.
+         * 
+         * Group: scheduler
+         * 
+         * @param backoffErrorThreshold the value to set
+         * @return the dsl builder
+         */
+        default HibernateEndpointConsumerBuilder backoffErrorThreshold(int 
backoffErrorThreshold) {
+            doSetProperty("backoffErrorThreshold", backoffErrorThreshold);
+            return this;
+        }
+        /**
+         * The number of subsequent error polls (failed due some error) that
+         * should happen before the backoffMultipler should kick-in.
+         * 
+         * The option will be converted to a <code>int</code> type.
+         * 
+         * Group: scheduler
+         * 
+         * @param backoffErrorThreshold the value to set
+         * @return the dsl builder
+         */
+        default HibernateEndpointConsumerBuilder backoffErrorThreshold(String 
backoffErrorThreshold) {
+            doSetProperty("backoffErrorThreshold", backoffErrorThreshold);
+            return this;
+        }
+        /**
+         * The number of subsequent idle polls that should happen before the
+         * backoffMultipler should kick-in.
+         * 
+         * The option is a: <code>int</code> type.
+         * 
+         * Group: scheduler
+         * 
+         * @param backoffIdleThreshold the value to set
+         * @return the dsl builder
+         */
+        default HibernateEndpointConsumerBuilder backoffIdleThreshold(int 
backoffIdleThreshold) {
+            doSetProperty("backoffIdleThreshold", backoffIdleThreshold);
+            return this;
+        }
+        /**
+         * The number of subsequent idle polls that should happen before the
+         * backoffMultipler should kick-in.
+         * 
+         * The option will be converted to a <code>int</code> type.
+         * 
+         * Group: scheduler
+         * 
+         * @param backoffIdleThreshold the value to set
+         * @return the dsl builder
+         */
+        default HibernateEndpointConsumerBuilder backoffIdleThreshold(String 
backoffIdleThreshold) {
+            doSetProperty("backoffIdleThreshold", backoffIdleThreshold);
+            return this;
+        }
+        /**
+         * To let the scheduled polling consumer backoff if there has been a
+         * number of subsequent idles/errors in a row. The multiplier is then
+         * the number of polls that will be skipped before the next actual
+         * attempt is happening again. When this option is in use then
+         * backoffIdleThreshold and/or backoffErrorThreshold must also be
+         * configured.
+         * 
+         * The option is a: <code>int</code> type.
+         * 
+         * Group: scheduler
+         * 
+         * @param backoffMultiplier the value to set
+         * @return the dsl builder
+         */
+        default HibernateEndpointConsumerBuilder backoffMultiplier(int 
backoffMultiplier) {
+            doSetProperty("backoffMultiplier", backoffMultiplier);
+            return this;
+        }
+        /**
+         * To let the scheduled polling consumer backoff if there has been a
+         * number of subsequent idles/errors in a row. The multiplier is then
+         * the number of polls that will be skipped before the next actual
+         * attempt is happening again. When this option is in use then
+         * backoffIdleThreshold and/or backoffErrorThreshold must also be
+         * configured.
+         * 
+         * The option will be converted to a <code>int</code> type.
+         * 
+         * Group: scheduler
+         * 
+         * @param backoffMultiplier the value to set
+         * @return the dsl builder
+         */
+        default HibernateEndpointConsumerBuilder backoffMultiplier(String 
backoffMultiplier) {
+            doSetProperty("backoffMultiplier", backoffMultiplier);
+            return this;
+        }
+        /**
+         * Milliseconds before the next poll.
+         * 
+         * The option is a: <code>long</code> type.
+         * 
+         * Default: 500
+         * Group: scheduler
+         * 
+         * @param delay the value to set
+         * @return the dsl builder
+         */
+        default HibernateEndpointConsumerBuilder delay(long delay) {
+            doSetProperty("delay", delay);
+            return this;
+        }
+        /**
+         * Milliseconds before the next poll.
+         * 
+         * The option will be converted to a <code>long</code> type.
+         * 
+         * Default: 500
+         * Group: scheduler
+         * 
+         * @param delay the value to set
+         * @return the dsl builder
+         */
+        default HibernateEndpointConsumerBuilder delay(String delay) {
+            doSetProperty("delay", delay);
+            return this;
+        }
+        /**
+         * If greedy is enabled, then the ScheduledPollConsumer will run
+         * immediately again, if the previous run polled 1 or more messages.
+         * 
+         * The option is a: <code>boolean</code> type.
+         * 
+         * Default: false
+         * Group: scheduler
+         * 
+         * @param greedy the value to set
+         * @return the dsl builder
+         */
+        default HibernateEndpointConsumerBuilder greedy(boolean greedy) {
+            doSetProperty("greedy", greedy);
+            return this;
+        }
+        /**
+         * If greedy is enabled, then the ScheduledPollConsumer will run
+         * immediately again, if the previous run polled 1 or more messages.
+         * 
+         * The option will be converted to a <code>boolean</code> type.
+         * 
+         * Default: false
+         * Group: scheduler
+         * 
+         * @param greedy the value to set
+         * @return the dsl builder
+         */
+        default HibernateEndpointConsumerBuilder greedy(String greedy) {
+            doSetProperty("greedy", greedy);
+            return this;
+        }
+        /**
+         * Milliseconds before the first poll starts.
+         * 
+         * The option is a: <code>long</code> type.
+         * 
+         * Default: 1000
+         * Group: scheduler
+         * 
+         * @param initialDelay the value to set
+         * @return the dsl builder
+         */
+        default HibernateEndpointConsumerBuilder initialDelay(long 
initialDelay) {
+            doSetProperty("initialDelay", initialDelay);
+            return this;
+        }
+        /**
+         * Milliseconds before the first poll starts.
+         * 
+         * The option will be converted to a <code>long</code> type.
+         * 
+         * Default: 1000
+         * Group: scheduler
+         * 
+         * @param initialDelay the value to set
+         * @return the dsl builder
+         */
+        default HibernateEndpointConsumerBuilder initialDelay(String 
initialDelay) {
+            doSetProperty("initialDelay", initialDelay);
+            return this;
+        }
+        /**
+         * Specifies a maximum limit of number of fires. So if you set it to 1,
+         * the scheduler will only fire once. If you set it to 5, it will only
+         * fire five times. A value of zero or negative means fire forever.
+         * 
+         * The option is a: <code>long</code> type.
+         * 
+         * Default: 0
+         * Group: scheduler
+         * 
+         * @param repeatCount the value to set
+         * @return the dsl builder
+         */
+        default HibernateEndpointConsumerBuilder repeatCount(long repeatCount) 
{
+            doSetProperty("repeatCount", repeatCount);
+            return this;
+        }
+        /**
+         * Specifies a maximum limit of number of fires. So if you set it to 1,
+         * the scheduler will only fire once. If you set it to 5, it will only
+         * fire five times. A value of zero or negative means fire forever.
+         * 
+         * The option will be converted to a <code>long</code> type.
+         * 
+         * Default: 0
+         * Group: scheduler
+         * 
+         * @param repeatCount the value to set
+         * @return the dsl builder
+         */
+        default HibernateEndpointConsumerBuilder repeatCount(String 
repeatCount) {
+            doSetProperty("repeatCount", repeatCount);
+            return this;
+        }
+        /**
+         * The consumer logs a start/complete log line when it polls. This
+         * option allows you to configure the logging level for that.
+         * 
+         * The option is a: <code>org.apache.camel.LoggingLevel</code> type.
+         * 
+         * Default: TRACE
+         * Group: scheduler
+         * 
+         * @param runLoggingLevel the value to set
+         * @return the dsl builder
+         */
+        default HibernateEndpointConsumerBuilder 
runLoggingLevel(org.apache.camel.LoggingLevel runLoggingLevel) {
+            doSetProperty("runLoggingLevel", runLoggingLevel);
+            return this;
+        }
+        /**
+         * The consumer logs a start/complete log line when it polls. This
+         * option allows you to configure the logging level for that.
+         * 
+         * The option will be converted to a
+         * <code>org.apache.camel.LoggingLevel</code> type.
+         * 
+         * Default: TRACE
+         * Group: scheduler
+         * 
+         * @param runLoggingLevel the value to set
+         * @return the dsl builder
+         */
+        default HibernateEndpointConsumerBuilder runLoggingLevel(String 
runLoggingLevel) {
+            doSetProperty("runLoggingLevel", runLoggingLevel);
+            return this;
+        }
+        /**
+         * Allows for configuring a custom/shared thread pool to use for the
+         * consumer. By default each consumer has its own single threaded 
thread
+         * pool.
+         * 
+         * The option is a:
+         * <code>java.util.concurrent.ScheduledExecutorService</code> type.
+         * 
+         * Group: scheduler
+         * 
+         * @param scheduledExecutorService the value to set
+         * @return the dsl builder
+         */
+        default HibernateEndpointConsumerBuilder 
scheduledExecutorService(ScheduledExecutorService scheduledExecutorService) {
+            doSetProperty("scheduledExecutorService", 
scheduledExecutorService);
+            return this;
+        }
+        /**
+         * Allows for configuring a custom/shared thread pool to use for the
+         * consumer. By default each consumer has its own single threaded 
thread
+         * pool.
+         * 
+         * The option will be converted to a
+         * <code>java.util.concurrent.ScheduledExecutorService</code> type.
+         * 
+         * Group: scheduler
+         * 
+         * @param scheduledExecutorService the value to set
+         * @return the dsl builder
+         */
+        default HibernateEndpointConsumerBuilder 
scheduledExecutorService(String scheduledExecutorService) {
+            doSetProperty("scheduledExecutorService", 
scheduledExecutorService);
+            return this;
+        }
+        /**
+         * To use a cron scheduler from either camel-spring or camel-quartz
+         * component. Use value spring or quartz for built in scheduler.
+         * 
+         * The option is a: <code>java.lang.Object</code> type.
+         * 
+         * Default: none
+         * Group: scheduler
+         * 
+         * @param scheduler the value to set
+         * @return the dsl builder
+         */
+        default HibernateEndpointConsumerBuilder scheduler(Object scheduler) {
+            doSetProperty("scheduler", scheduler);
+            return this;
+        }
+        /**
+         * To use a cron scheduler from either camel-spring or camel-quartz
+         * component. Use value spring or quartz for built in scheduler.
+         * 
+         * The option will be converted to a <code>java.lang.Object</code> 
type.
+         * 
+         * Default: none
+         * Group: scheduler
+         * 
+         * @param scheduler the value to set
+         * @return the dsl builder
+         */
+        default HibernateEndpointConsumerBuilder scheduler(String scheduler) {
+            doSetProperty("scheduler", scheduler);
+            return this;
+        }
+        /**
+         * To configure additional properties when using a custom scheduler or
+         * any of the Quartz, Spring based scheduler. This is a multi-value
+         * option with prefix: scheduler.
+         * 
+         * The option is a: <code>java.util.Map&lt;java.lang.String,
+         * java.lang.Object&gt;</code> type.
+         * The option is multivalued, and you can use the
+         * schedulerProperties(String, Object) method to add a value (call the
+         * method multiple times to set more values).
+         * 
+         * Group: scheduler
+         * 
+         * @param key the option key
+         * @param value the option value
+         * @return the dsl builder
+         */
+        default HibernateEndpointConsumerBuilder schedulerProperties(String 
key, Object value) {
+            doSetMultiValueProperty("schedulerProperties", "scheduler." + key, 
value);
+            return this;
+        }
+        /**
+         * To configure additional properties when using a custom scheduler or
+         * any of the Quartz, Spring based scheduler. This is a multi-value
+         * option with prefix: scheduler.
+         * 
+         * The option is a: <code>java.util.Map&lt;java.lang.String,
+         * java.lang.Object&gt;</code> type.
+         * The option is multivalued, and you can use the
+         * schedulerProperties(String, Object) method to add a value (call the
+         * method multiple times to set more values).
+         * 
+         * Group: scheduler
+         * 
+         * @param values the values
+         * @return the dsl builder
+         */
+        default HibernateEndpointConsumerBuilder schedulerProperties(Map 
values) {
+            doSetMultiValueProperties("schedulerProperties", "scheduler.", 
values);
+            return this;
+        }
+        /**
+         * Whether the scheduler should be auto started.
+         * 
+         * The option is a: <code>boolean</code> type.
+         * 
+         * Default: true
+         * Group: scheduler
+         * 
+         * @param startScheduler the value to set
+         * @return the dsl builder
+         */
+        default HibernateEndpointConsumerBuilder startScheduler(boolean 
startScheduler) {
+            doSetProperty("startScheduler", startScheduler);
+            return this;
+        }
+        /**
+         * Whether the scheduler should be auto started.
+         * 
+         * The option will be converted to a <code>boolean</code> type.
+         * 
+         * Default: true
+         * Group: scheduler
+         * 
+         * @param startScheduler the value to set
+         * @return the dsl builder
+         */
+        default HibernateEndpointConsumerBuilder startScheduler(String 
startScheduler) {
+            doSetProperty("startScheduler", startScheduler);
+            return this;
+        }
+        /**
+         * Time unit for initialDelay and delay options.
+         * 
+         * The option is a: <code>java.util.concurrent.TimeUnit</code> type.
+         * 
+         * Default: MILLISECONDS
+         * Group: scheduler
+         * 
+         * @param timeUnit the value to set
+         * @return the dsl builder
+         */
+        default HibernateEndpointConsumerBuilder timeUnit(TimeUnit timeUnit) {
+            doSetProperty("timeUnit", timeUnit);
+            return this;
+        }
+        /**
+         * Time unit for initialDelay and delay options.
+         * 
+         * The option will be converted to a
+         * <code>java.util.concurrent.TimeUnit</code> type.
+         * 
+         * Default: MILLISECONDS
+         * Group: scheduler
+         * 
+         * @param timeUnit the value to set
+         * @return the dsl builder
+         */
+        default HibernateEndpointConsumerBuilder timeUnit(String timeUnit) {
+            doSetProperty("timeUnit", timeUnit);
+            return this;
+        }
+        /**
+         * Controls if fixed delay or fixed rate is used. See
+         * ScheduledExecutorService in JDK for details.
+         * 
+         * The option is a: <code>boolean</code> type.
+         * 
+         * Default: true
+         * Group: scheduler
+         * 
+         * @param useFixedDelay the value to set
+         * @return the dsl builder
+         */
+        default HibernateEndpointConsumerBuilder useFixedDelay(boolean 
useFixedDelay) {
+            doSetProperty("useFixedDelay", useFixedDelay);
+            return this;
+        }
+        /**
+         * Controls if fixed delay or fixed rate is used. See
+         * ScheduledExecutorService in JDK for details.
+         * 
+         * The option will be converted to a <code>boolean</code> type.
+         * 
+         * Default: true
+         * Group: scheduler
+         * 
+         * @param useFixedDelay the value to set
+         * @return the dsl builder
+         */
+        default HibernateEndpointConsumerBuilder useFixedDelay(String 
useFixedDelay) {
+            doSetProperty("useFixedDelay", useFixedDelay);
+            return this;
+        }
+    }
+
+    /**
+     * Advanced builder for endpoint consumers for the Hibernate component.
+     */
+    public interface AdvancedHibernateEndpointConsumerBuilder
+            extends
+                EndpointConsumerBuilder {
+        default HibernateEndpointConsumerBuilder basic() {
+            return (HibernateEndpointConsumerBuilder) this;
+        }
+        /**
+         * 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 likes, will
+         * now be processed as a message and handled by the routing Error
+         * Handler. Important: This is only possible if the 3rd party component
+         * allows Camel to be alerted if an exception was thrown. Some
+         * components handle this internally only, and therefore
+         * bridgeErrorHandler is not possible. In other situations we may
+         * improve the Camel component to hook into the 3rd party component and
+         * make this possible for future releases. By default the consumer will
+         * use the org.apache.camel.spi.ExceptionHandler to deal with
+         * exceptions, that will be logged at WARN or ERROR level and ignored.
+         * 
+         * The option is a: <code>boolean</code> type.
+         * 
+         * Default: false
+         * Group: consumer (advanced)
+         * 
+         * @param bridgeErrorHandler the value to set
+         * @return the dsl builder
+         */
+        default AdvancedHibernateEndpointConsumerBuilder 
bridgeErrorHandler(boolean bridgeErrorHandler) {
+            doSetProperty("bridgeErrorHandler", bridgeErrorHandler);
+            return this;
+        }
+        /**
+         * 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 likes, will
+         * now be processed as a message and handled by the routing Error
+         * Handler. Important: This is only possible if the 3rd party component
+         * allows Camel to be alerted if an exception was thrown. Some
+         * components handle this internally only, and therefore
+         * bridgeErrorHandler is not possible. In other situations we may
+         * improve the Camel component to hook into the 3rd party component and
+         * make this possible for future releases. By default the consumer will
+         * use the org.apache.camel.spi.ExceptionHandler to deal with
+         * exceptions, that will be logged at WARN or ERROR level and ignored.
+         * 
+         * The option will be converted to a <code>boolean</code> type.
+         * 
+         * Default: false
+         * Group: consumer (advanced)
+         * 
+         * @param bridgeErrorHandler the value to set
+         * @return the dsl builder
+         */
+        default AdvancedHibernateEndpointConsumerBuilder 
bridgeErrorHandler(String bridgeErrorHandler) {
+            doSetProperty("bridgeErrorHandler", bridgeErrorHandler);
+            return this;
+        }
+        /**
+         * To let the consumer use a custom ExceptionHandler. Notice if the
+         * option bridgeErrorHandler is enabled then this option is not in use.
+         * By default the consumer will deal with exceptions, that will be
+         * logged at WARN or ERROR level and ignored.
+         * 
+         * The option is a: <code>org.apache.camel.spi.ExceptionHandler</code>
+         * type.
+         * 
+         * Group: consumer (advanced)
+         * 
+         * @param exceptionHandler the value to set
+         * @return the dsl builder
+         */
+        default AdvancedHibernateEndpointConsumerBuilder 
exceptionHandler(org.apache.camel.spi.ExceptionHandler exceptionHandler) {
+            doSetProperty("exceptionHandler", exceptionHandler);
+            return this;
+        }
+        /**
+         * To let the consumer use a custom ExceptionHandler. Notice if the
+         * option bridgeErrorHandler is enabled then this option is not in use.
+         * By default the consumer will deal with exceptions, that will be
+         * logged at WARN or ERROR level and ignored.
+         * 
+         * The option will be converted to a
+         * <code>org.apache.camel.spi.ExceptionHandler</code> type.
+         * 
+         * Group: consumer (advanced)
+         * 
+         * @param exceptionHandler the value to set
+         * @return the dsl builder
+         */
+        default AdvancedHibernateEndpointConsumerBuilder 
exceptionHandler(String exceptionHandler) {
+            doSetProperty("exceptionHandler", exceptionHandler);
+            return this;
+        }
+        /**
+         * Sets the exchange pattern when the consumer creates an exchange.
+         * 
+         * The option is a: <code>org.apache.camel.ExchangePattern</code> type.
+         * 
+         * Group: consumer (advanced)
+         * 
+         * @param exchangePattern the value to set
+         * @return the dsl builder
+         */
+        default AdvancedHibernateEndpointConsumerBuilder 
exchangePattern(org.apache.camel.ExchangePattern exchangePattern) {
+            doSetProperty("exchangePattern", exchangePattern);
+            return this;
+        }
+        /**
+         * Sets the exchange pattern when the consumer creates an exchange.
+         * 
+         * The option will be converted to a
+         * <code>org.apache.camel.ExchangePattern</code> type.
+         * 
+         * Group: consumer (advanced)
+         * 
+         * @param exchangePattern the value to set
+         * @return the dsl builder
+         */
+        default AdvancedHibernateEndpointConsumerBuilder 
exchangePattern(String exchangePattern) {
+            doSetProperty("exchangePattern", exchangePattern);
+            return this;
+        }
+        /**
+         * A pluggable org.apache.camel.PollingConsumerPollingStrategy allowing
+         * you to provide your custom implementation to control error handling
+         * usually occurred during the poll operation before an Exchange have
+         * been created and being routed in Camel.
+         * 
+         * The option is a:
+         * <code>org.apache.camel.spi.PollingConsumerPollStrategy</code> type.
+         * 
+         * Group: consumer (advanced)
+         * 
+         * @param pollStrategy the value to set
+         * @return the dsl builder
+         */
+        default AdvancedHibernateEndpointConsumerBuilder 
pollStrategy(org.apache.camel.spi.PollingConsumerPollStrategy pollStrategy) {
+            doSetProperty("pollStrategy", pollStrategy);
+            return this;
+        }
+        /**
+         * A pluggable org.apache.camel.PollingConsumerPollingStrategy allowing
+         * you to provide your custom implementation to control error handling
+         * usually occurred during the poll operation before an Exchange have
+         * been created and being routed in Camel.
+         * 
+         * The option will be converted to a
+         * <code>org.apache.camel.spi.PollingConsumerPollStrategy</code> type.
+         * 
+         * Group: consumer (advanced)
+         * 
+         * @param pollStrategy the value to set
+         * @return the dsl builder
+         */
+        default AdvancedHibernateEndpointConsumerBuilder pollStrategy(String 
pollStrategy) {
+            doSetProperty("pollStrategy", pollStrategy);
+            return this;
+        }
+    }
+
+    /**
+     * Builder for endpoint producers for the Hibernate component.
+     */
+    public interface HibernateEndpointProducerBuilder
+            extends
+                EndpointProducerBuilder {
+        default AdvancedHibernateEndpointProducerBuilder advanced() {
+            return (AdvancedHibernateEndpointProducerBuilder) this;
+        }
+
+        /**
+         * The HQL mutation query to execute.
+         * 
+         * The option is a: <code>java.lang.String</code> type.
+         * 
+         * Group: producer
+         * 
+         * @param mutationQuery the value to set
+         * @return the dsl builder
+         */
+        default HibernateEndpointProducerBuilder mutationQuery(String 
mutationQuery) {
+            doSetProperty("mutationQuery", mutationQuery);
+            return this;
+        }
+        /**
+         * The natural-id property values used for lookup.
+         * 
+         * The option is a: <code>java.util.Map&lt;java.lang.String,
+         * java.lang.Object&gt;</code> type.
+         * 
+         * Group: producer
+         * 
+         * @param naturalIdParameters the value to set
+         * @return the dsl builder
+         */
+        default HibernateEndpointProducerBuilder 
naturalIdParameters(Map<java.lang.String, java.lang.Object> 
naturalIdParameters) {
+            doSetProperty("naturalIdParameters", naturalIdParameters);
+            return this;
+        }
+        /**
+         * The natural-id property values used for lookup.
+         * 
+         * The option will be converted to a
+         * <code>java.util.Map&lt;java.lang.String, java.lang.Object&gt;</code>
+         * type.
+         * 
+         * Group: producer
+         * 
+         * @param naturalIdParameters the value to set
+         * @return the dsl builder
+         */
+        default HibernateEndpointProducerBuilder naturalIdParameters(String 
naturalIdParameters) {
+            doSetProperty("naturalIdParameters", naturalIdParameters);
+            return this;
+        }
+        /**
+         * Stateless operation to perform: insert or upsert.
+         * 
+         * The option is a: <code>java.lang.String</code> type.
+         * 
+         * Group: producer
+         * 
+         * @param statelessOperation the value to set
+         * @return the dsl builder
+         */
+        default HibernateEndpointProducerBuilder statelessOperation(String 
statelessOperation) {
+            doSetProperty("statelessOperation", statelessOperation);
+            return this;
+        }
+        /**
+         * Whether selection query results should be returned as a stream.
+         * 
+         * The option is a: <code>boolean</code> type.
+         * 
+         * Default: false
+         * Group: producer
+         * 
+         * @param streaming the value to set
+         * @return the dsl builder
+         */
+        default HibernateEndpointProducerBuilder streaming(boolean streaming) {
+            doSetProperty("streaming", streaming);
+            return this;
+        }
+        /**
+         * Whether selection query results should be returned as a stream.
+         * 
+         * The option will be converted to a <code>boolean</code> type.
+         * 
+         * Default: false
+         * Group: producer
+         * 
+         * @param streaming the value to set
+         * @return the dsl builder
+         */
+        default HibernateEndpointProducerBuilder streaming(String streaming) {
+            doSetProperty("streaming", streaming);
+            return this;
+        }
+    }
+
+    /**
+     * Advanced builder for endpoint producers for the Hibernate component.
+     */
+    public interface AdvancedHibernateEndpointProducerBuilder extends 
EndpointProducerBuilder {
+        default HibernateEndpointProducerBuilder basic() {
+            return (HibernateEndpointProducerBuilder) this;
+        }
+
+        /**
+         * Whether the producer should be started lazy (on the first message).
+         * By starting lazy you can use this to allow CamelContext and routes 
to
+         * startup in situations where a producer may otherwise fail during
+         * starting and cause the route to fail being started. By deferring 
this
+         * startup to be lazy then the startup failure can be handled during
+         * routing messages via Camel's routing error handlers. Beware that 
when
+         * the first message is processed then creating and starting the
+         * producer may take a little time and prolong the total processing 
time
+         * of the processing.
+         * 
+         * The option is a: <code>boolean</code> type.
+         * 
+         * Default: false
+         * Group: producer (advanced)
+         * 
+         * @param lazyStartProducer the value to set
+         * @return the dsl builder
+         */
+        default AdvancedHibernateEndpointProducerBuilder 
lazyStartProducer(boolean lazyStartProducer) {
+            doSetProperty("lazyStartProducer", lazyStartProducer);
+            return this;
+        }
+        /**
+         * Whether the producer should be started lazy (on the first message).
+         * By starting lazy you can use this to allow CamelContext and routes 
to
+         * startup in situations where a producer may otherwise fail during
+         * starting and cause the route to fail being started. By deferring 
this
+         * startup to be lazy then the startup failure can be handled during
+         * routing messages via Camel's routing error handlers. Beware that 
when
+         * the first message is processed then creating and starting the
+         * producer may take a little time and prolong the total processing 
time
+         * of the processing.
+         * 
+         * The option will be converted to a <code>boolean</code> type.
+         * 
+         * Default: false
+         * Group: producer (advanced)
+         * 
+         * @param lazyStartProducer the value to set
+         * @return the dsl builder
+         */
+        default AdvancedHibernateEndpointProducerBuilder 
lazyStartProducer(String lazyStartProducer) {
+            doSetProperty("lazyStartProducer", lazyStartProducer);
+            return this;
+        }
+    }
+
+    /**
+     * Builder for endpoint for the Hibernate component.
+     */
+    public interface HibernateEndpointBuilder
+            extends
+                HibernateEndpointConsumerBuilder,
+                HibernateEndpointProducerBuilder {
+        default AdvancedHibernateEndpointBuilder advanced() {
+            return (AdvancedHibernateEndpointBuilder) this;
+        }
+
+    }
+
+    /**
+     * Advanced builder for endpoint for the Hibernate component.
+     */
+    public interface AdvancedHibernateEndpointBuilder
+            extends
+                AdvancedHibernateEndpointConsumerBuilder,
+                AdvancedHibernateEndpointProducerBuilder {
+        default HibernateEndpointBuilder basic() {
+            return (HibernateEndpointBuilder) this;
+        }
+
+    }
+
+    public interface HibernateBuilders {
+        /**
+         * Hibernate (camel-hibernate)
+         * Camel Hibernate Component
+         * 
+         * Category: database
+         * Since: 4.23
+         * Maven coordinates: org.apache.camel:camel-hibernate
+         * 
+         * @return the dsl builder for the headers' name.
+         */
+        default HibernateHeaderNameBuilder hibernate() {
+            return HibernateHeaderNameBuilder.INSTANCE;
+        }
+        /**
+         * Hibernate (camel-hibernate)
+         * Camel Hibernate Component
+         * 
+         * Category: database
+         * Since: 4.23
+         * Maven coordinates: org.apache.camel:camel-hibernate
+         * 
+         * Syntax: <code>hibernate:entityClassName</code>
+         * 
+         * Path parameter: entityClassName (required)
+         * Target entity class name or entity type name
+         * 
+         * @param path entityClassName
+         * @return the dsl builder
+         */
+        default HibernateEndpointBuilder hibernate(String path) {
+            return 
HibernateEndpointBuilderFactory.endpointBuilder("hibernate", path);
+        }
+        /**
+         * Hibernate (camel-hibernate)
+         * Camel Hibernate Component
+         * 
+         * Category: database
+         * Since: 4.23
+         * Maven coordinates: org.apache.camel:camel-hibernate
+         * 
+         * Syntax: <code>hibernate:entityClassName</code>
+         * 
+         * Path parameter: entityClassName (required)
+         * Target entity class name or entity type name
+         * 
+         * @param componentName to use a custom component name for the endpoint
+         * instead of the default name
+         * @param path entityClassName
+         * @return the dsl builder
+         */
+        default HibernateEndpointBuilder hibernate(String componentName, 
String path) {
+            return 
HibernateEndpointBuilderFactory.endpointBuilder(componentName, path);
+        }
+
+    }
+    /**
+     * The builder of headers' name for the Hibernate component.
+     */
+    public static class HibernateHeaderNameBuilder {
+        /**
+         * The internal instance of the builder used to access to all the
+         * methods representing the name of headers.
+         */
+        public static final HibernateHeaderNameBuilder INSTANCE = new 
HibernateHeaderNameBuilder();
+
+        /**
+         * Map of named parameters to bind to the Hibernate query.
+         * 
+         * The option is a: {@code } type.
+         * 
+         * Group: producer
+         * 
+         * @return the name of the header {@code HibernateParameters}.
+         */
+        public String hibernateParameters() {
+            return "CamelHibernateParameters";
+        }
+        /**
+         * The Hibernate Session associated with the current exchange.
+         * 
+         * The option is a: {@code } type.
+         * 
+         * Group: producer
+         * 
+         * @return the name of the header {@code HibernateSession}.
+         */
+        public String hibernateSession() {
+            return "CamelHibernateSession";

Review Comment:
   Stale as well: `CamelHibernateSession` no longer exists and there is no 
`consumeDelete` builder method. Please regenerate camel-endpointdsl after the 
catalog.



##########
components/camel-hibernate/src/main/java/org/apache/camel/component/hibernate/HibernateProducer.java:
##########
@@ -0,0 +1,213 @@
+/*
+ * 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.hibernate;
+
+import java.util.Map;
+import java.util.stream.Stream;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.support.DefaultProducer;
+import org.apache.camel.support.SynchronizationAdapter;
+import org.hibernate.KeyType;
+import org.hibernate.Session;
+import org.hibernate.StatelessSession;
+import org.hibernate.Transaction;
+import org.hibernate.query.MutationQuery;
+import org.hibernate.query.SelectionQuery;
+
+public class HibernateProducer extends DefaultProducer {
+
+    private final HibernateEndpoint endpoint;
+
+    public HibernateProducer(HibernateEndpoint endpoint) {
+        super(endpoint);
+        this.endpoint = endpoint;
+    }
+
+    @Override
+    public void process(Exchange exchange) throws Exception {
+        if (endpoint.getStatelessOperation() != null) {
+            processStateless(exchange);
+            return;
+        }
+
+        HibernateSessionContext sessionContext = 
exchange.getExchangeExtension()
+                
.getSafeCopyProperty(HibernateConstants.HIBERNATE_SESSION_CONTEXT, 
HibernateSessionContext.class);
+
+        Session session = sessionContext == null
+                ? null
+                : sessionContext.getSession(endpoint.getSessionFactory(), 
endpoint.getTenantIdentifier());
+
+        boolean sessionOwned = session == null;
+
+        if (sessionOwned) {
+            session = endpoint.getTenantIdentifier() == null
+                    ? endpoint.getSessionFactory().openSession()
+                    : endpoint.getSessionFactory().withOptions()
+                            .tenantIdentifier(endpoint.getTenantIdentifier())
+                            .openSession();
+        }
+
+        final Session activeSession = session;
+        final Transaction transaction = sessionOwned
+                ? activeSession.beginTransaction()
+                : activeSession.getTransaction();
+
+        try {
+            if (sessionOwned && endpoint.getFilters() != null) {

Review Comment:
   When the producer reuses the consumer's session (`sessionOwned == false`), 
its own `filters` are silently ignored, and the consumer's enabled filters 
apply to the producer's query instead. Could the filter configuration be part 
of the reuse check in `HibernateSessionContext.getSession`, falling back to a 
new session when the producer and consumer filters differ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to