You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ji...@apache.org on 2023/08/03 07:44:40 UTC

[camel-quarkus] 04/04: Fixed JPA (CAMEL-19225)

This is an automated email from the ASF dual-hosted git repository.

jiriondrusek pushed a commit to branch camel-main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 256e2f9db81c0c5007e21933a5927a1a832ba0c7
Author: JiriOndrusek <on...@gmail.com>
AuthorDate: Thu Aug 3 09:28:29 2023 +0200

    Fixed JPA (CAMEL-19225)
---
 .../ROOT/pages/reference/extensions/jpa.adoc       |  3 --
 .../component/jpa/deployment/JpaProcessor.java     | 19 -----------
 .../jpa/runtime/src/main/doc/configuration.adoc    |  3 --
 .../quarkus/component/jpa/CamelJpaRecorder.java    | 38 ----------------------
 4 files changed, 63 deletions(-)

diff --git a/docs/modules/ROOT/pages/reference/extensions/jpa.adoc b/docs/modules/ROOT/pages/reference/extensions/jpa.adoc
index c5aadd3de9..0b55384217 100644
--- a/docs/modules/ROOT/pages/reference/extensions/jpa.adoc
+++ b/docs/modules/ROOT/pages/reference/extensions/jpa.adoc
@@ -52,6 +52,3 @@ The extension leverages https://quarkus.io/guides/hibernate-orm[Quarkus Hibernat
 
 Refer to the https://quarkus.io/guides/hibernate-orm[Quarkus Hibernate ORM] documentation to see how to configure Hibernate and your datasource,
 
-When a single persistence unit is used, the Camel Quarkus JPA extension will automatically configure the JPA component with a
-`EntityManagerFactory` and `TransactionManager`.
-
diff --git a/extensions/jpa/deployment/src/main/java/org/apache/camel/quarkus/component/jpa/deployment/JpaProcessor.java b/extensions/jpa/deployment/src/main/java/org/apache/camel/quarkus/component/jpa/deployment/JpaProcessor.java
index d2dc9bfd36..6d53641456 100644
--- a/extensions/jpa/deployment/src/main/java/org/apache/camel/quarkus/component/jpa/deployment/JpaProcessor.java
+++ b/extensions/jpa/deployment/src/main/java/org/apache/camel/quarkus/component/jpa/deployment/JpaProcessor.java
@@ -16,14 +16,8 @@
  */
 package org.apache.camel.quarkus.component.jpa.deployment;
 
-import io.quarkus.deployment.annotations.BuildProducer;
 import io.quarkus.deployment.annotations.BuildStep;
-import io.quarkus.deployment.annotations.ExecutionTime;
-import io.quarkus.deployment.annotations.Record;
 import io.quarkus.deployment.builditem.FeatureBuildItem;
-import org.apache.camel.component.jpa.JpaComponent;
-import org.apache.camel.quarkus.component.jpa.CamelJpaRecorder;
-import org.apache.camel.quarkus.core.deployment.spi.CamelRuntimeBeanBuildItem;
 
 class JpaProcessor {
 
@@ -33,17 +27,4 @@ class JpaProcessor {
     FeatureBuildItem feature() {
         return new FeatureBuildItem(FEATURE);
     }
-
-    @Record(ExecutionTime.RUNTIME_INIT)
-    @BuildStep
-    void configureJpaComponentBean(
-            BuildProducer<CamelRuntimeBeanBuildItem> camelRuntimeBean,
-            CamelJpaRecorder recorder) {
-
-        camelRuntimeBean.produce(
-                new CamelRuntimeBeanBuildItem(
-                        "jpa",
-                        JpaComponent.class.getName(),
-                        recorder.createJpaComponent()));
-    }
 }
diff --git a/extensions/jpa/runtime/src/main/doc/configuration.adoc b/extensions/jpa/runtime/src/main/doc/configuration.adoc
index ebb4d86353..f398236b25 100644
--- a/extensions/jpa/runtime/src/main/doc/configuration.adoc
+++ b/extensions/jpa/runtime/src/main/doc/configuration.adoc
@@ -1,6 +1,3 @@
 The extension leverages https://quarkus.io/guides/hibernate-orm[Quarkus Hibernate ORM] to provide the JPA implementation via Hibernate.
 
 Refer to the https://quarkus.io/guides/hibernate-orm[Quarkus Hibernate ORM] documentation to see how to configure Hibernate and your datasource,
-
-When a single persistence unit is used, the Camel Quarkus JPA extension will automatically configure the JPA component with a
-`EntityManagerFactory` and `TransactionManager`.
diff --git a/extensions/jpa/runtime/src/main/java/org/apache/camel/quarkus/component/jpa/CamelJpaRecorder.java b/extensions/jpa/runtime/src/main/java/org/apache/camel/quarkus/component/jpa/CamelJpaRecorder.java
deleted file mode 100644
index 58b7f0fb84..0000000000
--- a/extensions/jpa/runtime/src/main/java/org/apache/camel/quarkus/component/jpa/CamelJpaRecorder.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.quarkus.component.jpa;
-
-import io.quarkus.arc.Arc;
-import io.quarkus.runtime.RuntimeValue;
-import io.quarkus.runtime.annotations.Recorder;
-import jakarta.transaction.TransactionManager;
-import jakarta.transaction.UserTransaction;
-import org.apache.camel.component.jpa.JpaComponent;
-import org.springframework.transaction.jta.JtaTransactionManager;
-
-@Recorder
-public class CamelJpaRecorder {
-
-    public RuntimeValue<JpaComponent> createJpaComponent() {
-        TransactionManager transactionManager = Arc.container().instance(TransactionManager.class).get();
-        UserTransaction userTransaction = Arc.container().instance(UserTransaction.class).get();
-
-        JpaComponent component = new JpaComponent();
-        component.setTransactionManager(new JtaTransactionManager(userTransaction, transactionManager));
-        return new RuntimeValue<>(component);
-    }
-}