From 256e2f9db81c0c5007e21933a5927a1a832ba0c7 Mon Sep 17 00:00:00 2001 From: JiriOndrusek Date: Thu, 3 Aug 2023 09:28:29 +0200 Subject: [PATCH] Fixed JPA (CAMEL-19225) --- .../ROOT/pages/reference/extensions/jpa.adoc | 3 -- .../jpa/deployment/JpaProcessor.java | 19 ---------- .../runtime/src/main/doc/configuration.adoc | 3 -- .../component/jpa/CamelJpaRecorder.java | 38 ------------------- 4 files changed, 63 deletions(-) delete mode 100644 extensions/jpa/runtime/src/main/java/org/apache/camel/quarkus/component/jpa/CamelJpaRecorder.java diff --git a/docs/modules/ROOT/pages/reference/extensions/jpa.adoc b/docs/modules/ROOT/pages/reference/extensions/jpa.adoc index c5aadd3de910..0b55384217b4 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 d2dc9bfd36a0..6d5364145680 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 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 ebb4d863538e..f398236b25fa 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 58b7f0fb8459..000000000000 --- 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 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); - } -}