You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by zh...@apache.org on 2023/08/04 06:24:33 UTC
[camel] branch main updated: CAMEL-19225: camel-jpa - Refactor JpaComponent (#10992)
This is an automated email from the ASF dual-hosted git repository.
zhfeng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 7f999c187e3 CAMEL-19225: camel-jpa - Refactor JpaComponent (#10992)
7f999c187e3 is described below
commit 7f999c187e3b06aa155647b5b0b60e4f86ad4cc7
Author: Zheng Feng <zh...@gmail.com>
AuthorDate: Fri Aug 4 14:24:25 2023 +0800
CAMEL-19225: camel-jpa - Refactor JpaComponent (#10992)
---
.../org/apache/camel/component/jpa/JpaComponent.java | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaComponent.java b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaComponent.java
index b409f57e01c..cc55c69c08d 100644
--- a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaComponent.java
+++ b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaComponent.java
@@ -186,20 +186,23 @@ public class JpaComponent extends HealthCheckComponent {
super.doInit();
initEntityManagerFactory();
+ // warn about missing configuration
+ if (entityManagerFactory == null) {
+ LOG.warn(
+ "No EntityManagerFactory has been configured on this JpaComponent. Each JpaEndpoint will auto create their own EntityManagerFactory.");
+ }
+
if (transactionStrategy != null) {
LOG.info("Using TransactionStrategy configured: {}", transactionStrategy);
- return;
+ } else {
+ createTransactionStrategy();
}
+ }
+ private void createTransactionStrategy() {
if (transactionStrategy == null && getEntityManagerFactory() != null) {
transactionStrategy = new DefaultTransactionStrategy(getCamelContext(), getEntityManagerFactory());
}
-
- // warn about missing configuration
- if (entityManagerFactory == null) {
- LOG.warn(
- "No EntityManagerFactory has been configured on this JpaComponent. Each JpaEndpoint will auto create their own EntityManagerFactory.");
- }
}
@Override