Skip to content

CAMEL-26106: camel-jpa: don't hard-wire the Spring based DefaultTransactionStrategy as the default - #28496

Open
JiriOndrusek wants to merge 4 commits into
apache:mainfrom
jiriOndrusek-agent:agent_CAMEL-26106-jpa-default-strategy
Open

JiriOndrusek wants to merge 4 commits into
apache:mainfrom
jiriOndrusek-agent:agent_CAMEL-26106-jpa-default-strategy

Conversation

@JiriOndrusek

Copy link
Copy Markdown
Contributor

https://issues.apache.org/jira/browse/CAMEL-26106

  • JpaHelper.resolveTransactionStrategy: use the single TransactionStrategy bean from the registry, else fall back to DefaultTransactionStrategy
  • The fallback is created in one place (JpaHelper.createDefaultTransactionStrategy); JpaComponent, JpaEndpoint, JpaMessageIdRepository, JpaKeyValueRepository no longer reference the Spring based class
  • JpaEndpoint.createTransactionStrategy() returns TransactionStrategy (upgrade guide entry)
  • Docs corrected; tests for the registry lookup

Generated with Claude Code on behalf of @JiriOndrusek

@github-actions

Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • catalog/camel-catalog
  • components/camel-jpa
  • docs

🔁 1 test passed only after a retry on JDK 21 (1 retried attempt)

Recovered flaky tests on JDK 21 (1)
Module Test Failed attempts First failure
dsl/camel-jbang/camel-jbang-plugin-tui MonitorStartupTest.browserOnlyServesUntilTheServerStops 1 Connection refused (connect failed)

ℹ️ These tests did not fail the build. Surefire retried them and they passed.
Retries are enabled project-wide by surefire.rerunFailingTestsCount in parent/pom.xml.


🔬 Scalpel shadow comparison — Scalpel: 9 of 713 tested, 25 compile-only — current: 9 all tested

Maveniverse Scalpel detected 9 affected modules (current approach: 9).

Skip-tests mode would test 9 modules (3 direct + 8 downstream), skip tests for 25 (generated code, meta-modules)

Modules Scalpel would test (9)
  • camel-jbang-export ← downstream of org.apache.camel:camel-catalog
  • camel-jbang-mcp ← downstream of org.apache.camel:camel-catalog
  • camel-jbang-plugin-mcp ← downstream of org.apache.camel:camel-jbang-core
  • camel-jbang-plugin-tui ← downstream of org.apache.camel:camel-catalog
  • camel-jbang-plugin-validate ← downstream of org.apache.camel:camel-yaml-dsl-validator
  • camel-jpa ← components/camel-jpa/src/generated/java/org/apache/camel/component/jpa/JpaComponentConfigurer.java, components/camel-jpa/src/generated/resources/META-INF/org/apache/camel/component/jpa/jpa.json, components/camel-jpa/src/main/docs/jpa-component.adoc, components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaComponent.java, components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java, components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaHelper.java, components/camel-jpa/src/main/java/org/apache/camel/processor/idempotent/jpa/JpaMessageIdRepository.java, components/camel-jpa/src/main/java/org/apache/camel/processor/keyvalue/jpa/JpaKeyValueRepository.java, components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaComponentTest.java, components/camel-jpa/src/test/java/org/apache/camel/processor/idempotent/jpa/JpaMessageIdRepositoryTest.java, components/camel-jpa/src/test/java/org/apache/camel/processor/keyvalue/jpa/JpaKeyValueRepositoryTest.java
  • camel-launcher-container ← downstream of org.apache.camel:camel-launcher
  • camel-yaml-dsl-validator ← downstream of org.apache.camel:camel-catalog
  • camel-yaml-dsl-validator-maven-plugin ← downstream of org.apache.camel:camel-yaml-dsl-validator
Modules with tests skipped (25)
  • apache-camel
  • camel-allcomponents
  • camel-catalog-console
  • camel-catalog-maven
  • camel-catalog-suggest
  • camel-componentdsl
  • camel-endpointdsl
  • camel-endpointdsl-support
  • camel-itest
  • camel-jbang-core
  • camel-jbang-it
  • camel-jbang-main
  • camel-jbang-plugin-edit
  • camel-jbang-plugin-generate
  • camel-jbang-plugin-kubernetes
  • camel-jbang-plugin-test
  • camel-kamelet-main
  • camel-launcher
  • camel-report-maven-plugin
  • camel-route-parser
  • camel-yaml-dsl
  • camel-yaml-dsl-deserializers
  • camel-yaml-dsl-maven-plugin
  • coverage
  • dummy-component

ℹ️ Shadow mode — Scalpel observes but does not affect test execution. Learn more

All tested modules (36 modules, 6m 14s total)

Total reactor time: 6m 14s

Module Duration Status
Camel :: JPA 51.9s SUCCESS
Camel :: JBang :: MCP 50.1s SUCCESS
Camel :: Component DSL 29.7s SUCCESS
Camel :: JBang :: Plugin :: Validate 29.5s SUCCESS
Camel :: YAML DSL :: Validator 27.8s SUCCESS
Camel :: Catalog :: Camel Catalog 24.9s SUCCESS
Camel :: YAML DSL 23.5s SUCCESS
Camel :: Kamelet Main 17.5s SUCCESS
Camel :: JBang :: Plugin :: Testing 17.4s SUCCESS
Camel :: JBang :: Plugin :: Kubernetes 16.9s SUCCESS
Camel :: Docs 15.8s SUCCESS
Camel :: JBang :: Export 14.6s SUCCESS
Camel :: YAML DSL :: Deserializers 8.5s SUCCESS
Camel :: Catalog :: Camel Route Parser 7.7s SUCCESS
Camel :: Catalog :: Camel Report Maven Plugin 7.4s SUCCESS
Camel :: All Components Sync point 4.8s SUCCESS
Camel :: YAML DSL :: Validator Maven Plugin 4.0s SUCCESS
Camel :: YAML DSL :: Maven Plugins 3.5s SUCCESS
Camel :: Assembly 3.5s SUCCESS
Camel :: Catalog :: Maven 3.1s SUCCESS
Camel :: Catalog :: Suggest (deprecated) 2.1s SUCCESS
Camel :: Coverage 1.4s SUCCESS
Camel :: JBang :: Plugin :: MCP 1.3s SUCCESS
Camel :: Catalog :: Console 1.2s SUCCESS
Camel :: JBang :: Integration tests 1.1s SUCCESS
Camel :: JBang :: Plugin :: Generate 1.1s SUCCESS
Camel :: Catalog :: Dummy Component 1.0s SUCCESS
Camel :: JBang :: Main 0.9s SUCCESS
Camel :: Endpoint DSL :: Support 0.9s SUCCESS
Camel :: JBang :: Plugin :: Edit 0.9s SUCCESS
Camel :: Launcher :: Container 0.5s SUCCESS
Camel :: Endpoint DSL n/a
Camel :: Integration Tests n/a
Camel :: JBang :: Core n/a
Camel :: JBang :: Plugin :: TUI n/a
Camel :: Launcher n/a

Top 20 slowest modules:

  • Camel :: JPA (51.9s)
  • Camel :: JBang :: MCP (50.1s)
  • Camel :: Component DSL (29.7s)
  • Camel :: JBang :: Plugin :: Validate (29.5s)
  • Camel :: YAML DSL :: Validator (27.8s)
  • Camel :: Catalog :: Camel Catalog (24.9s)
  • Camel :: YAML DSL (23.5s)
  • Camel :: Kamelet Main (17.5s)
  • Camel :: JBang :: Plugin :: Testing (17.4s)
  • Camel :: JBang :: Plugin :: Kubernetes (16.9s)
  • Camel :: Docs (15.8s)
  • Camel :: JBang :: Export (14.6s)
  • Camel :: YAML DSL :: Deserializers (8.5s)
  • Camel :: Catalog :: Camel Route Parser (7.7s)
  • Camel :: Catalog :: Camel Report Maven Plugin (7.4s)
  • Camel :: All Components Sync point (4.8s)
  • Camel :: YAML DSL :: Validator Maven Plugin (4.0s)
  • Camel :: YAML DSL :: Maven Plugins (3.5s)
  • Camel :: Assembly (3.5s)
  • Camel :: Catalog :: Maven (3.1s)

⚙️ View full build and test results

@oscerd oscerd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean refactor — centralising the "which TransactionStrategy?" decision in JpaHelper.resolveTransactionStrategy(...) and routing JpaComponent, JpaEndpoint, JpaMessageIdRepository and JpaKeyValueRepository through it reads well, and keeping the Spring DefaultTransactionStrategy construction in a single private method so non-Spring runtimes can swap it is a nice touch. Tests cover the default and the from-registry paths for both component and endpoint, the docs are updated, and the upgrade-guide entry is present.

A few non-blocking questions:

  1. findSingleByType returns null when the registry holds more than one TransactionStrategy, so the code silently falls back to DefaultTransactionStrategy. The previous behaviour logged a WARN when multiple were found (and the old docs mention it). Worth a LOG.warn/debug when >1 is present and ignored, so a misconfigured registry isn't silent?
  2. Could you confirm the previous "look up a TransactionTemplate and extract the strategy from it" behaviour is fully preserved inside DefaultTransactionStrategy (it now runs only when no single TransactionStrategy bean exists), so users relying on a registered TransactionTemplate see no change?
  3. The protected JpaEndpoint.createTransactionStrategy() return-type widening (DefaultTransactionStrategy → TransactionStrategy) — correctly called out in the upgrade guide; just flagging it affects any subclass overriding it.

Claude Code on behalf of oscerd

@jiriOndrusek-agent

Copy link
Copy Markdown

Thanks for the review!

  1. More than one TransactionStrategy – Added in 8070767b0864. findSingleByType still picks the bean (JpaHelper.java:103). When it returns null, JpaHelper.java:107-112 counts the beans and logs a WARN if there is more than one, then the default is created. New test: JpaComponentTest.testJpaComponentMoreTransactionStrategiesInRegistry. Docs and upgrade guide updated.
    Small correction: the old code never warned here, because it never looked up a TransactionStrategy at all, so extra beans were ignored silently. The WARN at JpaComponent.java:175 is about a missing EntityManagerFactory. The doc sentence is left over from the old TransactionManager lookup (removed in CAMEL-19225); CAMEL-19782 only renamed it in the docs.

  2. TransactionTemplate – Preserved. The PR does not touch DefaultTransactionStrategy. Without a single TransactionStrategy bean, it is still created with the same arguments as before (JpaHelper.java:114, :135). Its initTransactionManager uses a single PlatformTransactionManager (DefaultTransactionStrategy.java:67-78), else the transaction manager of a single TransactionTemplate (:84-96), else a new JpaTransactionManager (:38-39). As before, only the template's transaction manager is reused. A new TransactionTemplate with PROPAGATION_REQUIRED is created (:41, :105-110). So users with a registered template see a change only if they also register exactly one TransactionStrategy.

  3. Return type of createTransactionStrategy() – Nothing in the Camel repo overrides it: git grep only finds JpaEndpoint.java:285 and :625. The camel-quarkus JPA extension rewrites it by method name only, so it is not affected. A user override that returns DefaultTransactionStrategy still compiles (covariant return), but it has to be recompiled: a class built against the old signature is silently not called. I can add that to the upgrade guide if you like.

Generated with Claude Code on behalf of @JiriOndrusek

@davsclaus davsclaus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Jiri, routing the call sites through JpaHelper.resolveTransactionStrategy is a nice clean-up. Keeping the Spring DefaultTransactionStrategy creation in one method makes the Camel Quarkus side much simpler, and Spring and Spring Boot users see no change unless they already have a single TransactionStrategy bean. The docs now describe what the code actually does, and the new WARN plus its test for several beans (8070767) cover the ambiguous case.

A few points:

  1. Autowiring. The component lookup goes around Camel's autowiring. entityManagerFactory on JpaComponent is @Metadata(autowired = true), but transactionStrategy (JpaComponent.java:46) is not, so the new findSingleByType in JpaHelper.resolveTransactionStrategy is used even when autowiredEnabled=false is set on the component or the context. Could we mark transactionStrategy as autowired instead? DefaultAutowiredLifecycleStrategy would then set it when the component is added, honouring autowiredEnabled; JpaEndpoint.doInit already copies it from the component, and the catalog would show it as autowired. The endpoint lookup can stay for endpoints on a component without a factory. This needs the catalog, configurer and component DSL regenerated.

  2. Logging. The WARN is evaluated on every resolution, so with several beans it is logged once for the component and again for each endpoint without a strategy. Not a big deal, but logging it once (or at DEBUG for the endpoints) would be quieter. An INFO line naming the bean that was picked (findByTypeWithName), like DefaultTransactionStrategy does for its TransactionManager, would also help.

  3. Upgrade guide. Two additions would help:

    • A single registry bean now applies to every JPA component and endpoint without a configured strategy, including ones using a different EntityManagerFactory. If the bean is tied to one factory (for example a DefaultTransactionStrategy built for it), set transactionStrategy explicitly.
    • Subclasses that override JpaEndpoint.createTransactionStrategy() must be recompiled: a class compiled against the old DefaultTransactionStrategy return type has a different method descriptor and is otherwise silently not called.
  4. Comment on JpaHelper.createDefaultTransactionStrategy. The repositories still pass null as the context, so this private method is what Camel Quarkus will need to substitute. Could the comment say that it is replaced by name, so a later refactoring does not break it? The JIRA also mentioned FactoryFinder, which would avoid patching altogether. Was that considered?

  5. Tests. A test for the JpaMessageIdRepository(emf, processorName) default would be good. testJpaEndpointTransactionStrategyFromRegistry also leaves the factory the endpoint creates unclosed.

  6. Backport. The JIRA asks for 4.22.x. That changes behaviour (a registry bean is now used) and a protected method signature on an LTS line, so we should agree on it explicitly.

None of these are blockers on their own, but I'd like to settle point 1 before merging.


Reviewed with Claude Code on behalf of davsclaus. This review was generated by an AI agent and may contain inaccuracies; please verify all suggestions before applying.

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solid refactoring. Centralising the strategy-selection logic in JpaHelper.resolveTransactionStrategy() is the right call — the old pattern of each class creating its own DefaultTransactionStrategy was fragile and hard to extend. The new tests cover the key scenarios clearly.

One design observation worth discussing:

JpaMessageIdRepository and JpaKeyValueRepository both call resolveTransactionStrategy(null, entityManagerFactory). With null for the CamelContext argument, the registry lookup is bypassed entirely — these classes always fall back to DefaultTransactionStrategy, regardless of what's registered. This is consistent with the old behaviour (they previously called new DefaultTransactionStrategy(null, emf) directly), but it means users who register a custom TransactionStrategy in the Camel registry and use JpaMessageIdRepository or JpaKeyValueRepository directly won't benefit from the auto-discovery.

Was this intentional? These classes don't hold a CamelContext reference, so null is the only option at construction time. If the intent is to eventually support registry-based resolution here too, that would require adding a CamelContext field (or an alternative constructor). If the intent is to keep them Spring-independent at this layer, null is correct and the Javadoc on resolveTransactionStrategy's camelContext parameter ("or null if not available (then the registry is not used)") makes the design explicit.

No action required — raising it for awareness and to confirm the intent.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@jiriOndrusek-agent
jiriOndrusek-agent force-pushed the agent_CAMEL-26106-jpa-default-strategy branch from 8070767 to 8753588 Compare October 26, 2026 16:07
@jiriOndrusek-agent

Copy link
Copy Markdown

@davsclaus Thanks! Changes are in 8753588628 (the branch is also rebased on main).

  1. Autowiring – Done. transactionStrategy is now @Metadata(autowired = true) (JpaComponent.java:46), so autowiring sets it and honours autowiredEnabled. The configurer and the catalog are regenerated. The component DSL has no change, as it has no autowired marker (same for dataSource of camel-sql).
    The component keeps its lookup, but only when autowiring is enabled (JpaComponent.java:186-194). A component added with context.addComponent(...) is initialized before it is autowired (AbstractCamelContext.java:514-529). Without the lookup, the default would be created first and the bean ignored. The endpoint lookup uses the rule for autowired endpoint options (DefaultEndpoint.java:495), see JpaEndpoint.java:625-629.
    Tests: testJpaComponentTransactionStrategyAutowired, plus testJpaComponent… and testJpaEndpointTransactionStrategyNotFromRegistryWhenAutowiringDisabled.
  2. Logging – The WARN is never logged by both the component and the endpoints. Endpoints copy the component's strategy (JpaEndpoint.java:660-661). They resolve their own only when the component has none, i.e. when it has no EntityManagerFactory (JpaComponent.java:187). Then each endpoint creates its own default, so one WARN per endpoint matches what happens; I kept it. Added the INFO for the picked bean (JpaHelper.java:106). It shows the bean, not its id: the lookup stays findSingleByType, the same call autowiring uses (LifecycleStrategySupport.java:259), so both always pick the same bean.
  3. Upgrade guide – Both points are added.
  4. Comment – Updated (JpaHelper.java:134-135). FactoryFinder was considered. It needs a CamelContext, which the repositories don't have. newInstance uses the no-arg constructor, while DefaultTransactionStrategy needs the context and the factory, so it would also need a new factory SPI. One private method needs neither.
  5. Tests – Added JpaMessageIdRepositoryTest for the 2-arg constructor. testJpaEndpointTransactionStrategyFromRegistry now gives the endpoint a factory and closes it.
  6. Backport – Agreed, this needs an explicit decision. I'd keep this PR on main only. On 4.22.x, Camel Quarkus can keep handling it in its extension, so the LTS line gets no behaviour or API change.

Generated with Claude Code on behalf of @JiriOndrusek

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following up on my earlier review — both previous findings (design notes on JpaMessageIdRepository and JpaKeyValueRepository bypassing registry lookup with null camelContext) are addressed: the author confirmed the intent in the thread replies. ✅

One new observation on the updated code:

LOG.info for registry discovery — JpaHelper.resolveTransactionStrategy logs at INFO when a TransactionStrategy is found in the registry. This fires at component/endpoint initialization time; Camel's convention for internal autowiring resolution is DEBUG. INFO is appropriate for user-configured values, but a registry auto-discovery is internal wiring — see inline comment.

The double registry lookup when zero beans are present (findSingleByType → null, then findByType(...).size() for the >1 check) is technically two scans, but it only matters at startup and the cost is negligible. Noting for awareness, not a blocker.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@davsclaus davsclaus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Jiri. I re-checked the branch at 8753588 against my review of 8070767. Everything I raised is addressed, including point 1, which I wanted settled before merging:

  1. Autowiring. transactionStrategy is now @Metadata(autowired = true) (JpaComponent.java:46). The configurer's getAutowiredNames(), both jpa.json files and the catalog doc are regenerated, and CI's uncommitted-changes check passed. The component keeps its own lookup in doInit (JpaComponent.java:186-194), and I first wondered whether this duplicates the autowiring logic. It doesn't. AbstractCamelContext.addComponent initializes the component before postInitComponent runs the autowiring (AbstractCamelContext.java:517-528). Without the lookup, a component added that way with an explicit EntityManagerFactory would create the default first, and autowiring would then skip the non-null option. For components resolved by the context, autowiring sets the option before doInit, so the lookup never runs. The lookup uses the same flags as DefaultAutowiredLifecycleStrategy. The endpoint uses the rule DefaultEndpoint.doInit applies to autowired endpoint options, and the endpoint's autowiredEnabled already includes the context-level flag (DefaultComponent.java:157). Both lookups use findSingleByType, so they always pick the same bean as autowiring. The new tests cover the auto-created component, the addComponent-style init, and autowiredEnabled=false on both the context and the component.
  2. Logging. Agreed that endpoints log the WARN only when the component has no EntityManagerFactory, and then each endpoint does create its own default, so one WARN per endpoint is fair.
  3. Upgrade guide. Both additions are in: the bean applies whatever the EntityManagerFactory is, and subclasses overriding createTransactionStrategy() must be recompiled.
  4. Comment. JpaHelper.java:134-135 now says Camel Quarkus replaces the method by name. Thanks also for explaining why FactoryFinder doesn't fit (no context in the repositories, and only no-arg constructors).
  5. Tests. JpaMessageIdRepositoryTest covers the 2-arg constructor, and testJpaEndpointTransactionStrategyFromRegistry closes its factory.
  6. Backport. Agreed, main only. CAMEL-26106 still lists 4.22.3 as a fix version, so please remove it.

On gnodet-bot's open thread about JpaHelper.java:106 (INFO vs DEBUG): I asked for an INFO line in my last review, and at component level it matches the INFO that autowiring itself logs. An endpoint that resolves its own strategy logs it once per endpoint, though, and DefaultEndpoint logs endpoint autowiring at DEBUG. So DEBUG for the endpoint path (or for both) is fine with me too. Either way, a reply and resolving that thread is enough. It doesn't block.

Before this can be merged:

  • The branch conflicts with main in camel-4x-upgrade-guide-4_24.adoc (new entries were appended at the end on main), so it needs another rebase.
  • The red "Build and test" job is not caused by this PR. It is CatalogDocExamplesTest failing on the camel-hibernate doc examples (selectionQuery not applicable in producer/consumer only mode), which main fixed in #28530 after this run started. The rebase picks that fix up.

Approving, conditional on the rebase and a green CI.


Reviewed with Claude Code on behalf of davsclaus. This review was generated by an AI agent and may contain inaccuracies; please verify all suggestions before applying.

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following up on my earlier review — the null-camelContext design findings are addressed. One nit from my previous review remains open.

LOG.info for registry discovery — still INFO in the new commits. See inline comment.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following up on my earlier review — the remaining open nit (LOG.info → LOG.debug for registry discovery) is now addressed. Line 106 of JpaHelper.resolveTransactionStrategy uses LOG.debug, aligned with Camel’s convention for internal autowiring resolution. All previous gnodet-bot findings are resolved.

The overall refactoring is solid: centralising DefaultTransactionStrategy creation in JpaHelper.createDefaultTransactionStrategy gives Camel Quarkus a clean substitution point (documented in the comment), the @Metadata(autowired = true) annotation on transactionStrategy honours autowiredEnabled correctly, the tests cover the main paths (default, single registry bean, multiple beans → WARN, autowiring disabled at context and component levels, endpoint-only EMF), the EMF resource-leak in testJpaEndpointTransactionStrategyFromRegistry is fixed, and the upgrade guide accurately documents both the behavioural change and the binary-compat break on subclasses of JpaEndpoint.

LGTM.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@davsclaus

Copy link
Copy Markdown
Contributor

@jiriOndrusek-agent @JiriOndrusek the two open review threads on JpaHelper.java ask for LOG.info to become LOG.debug for the registry discovery message (auto-wiring is internal, so DEBUG is the convention). Maintainer edits are disabled on this PR, so could you push that change? The PR is approved and green otherwise.

Claude Code on behalf of Claus Ibsen

@jiriOndrusek-agent

Copy link
Copy Markdown

The registry discovery message is LOG.debug already: it is in a6750d43b1, the current PR head, pushed before this comment. The details and the debug check are in the reply on the inline thread at JpaHelper.java:107. Both open threads on that file (lines 106 and 107) ask for this same change, so they can be resolved.

Generated with Claude Code on behalf of @JiriOndrusek

@davsclaus davsclaus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-checked a6750d4 against my approval of 8753588. The rebase resolved the upgrade-guide conflict: the camel-jpa entry now comes after main's entries, and nothing else in the guide changed. The only code change is the new commit that logs the TransactionStrategy picked from the registry at DEBUG instead of INFO, which settles gnodet-bot's thread. My approval stands, pending a green CI on this head (queued).

One leftover from my last review: CAMEL-26106 still lists 4.22.3 as a fix version. Since this is main only, please remove it.

Claude Code on behalf of davsclaus. This review was generated by an AI agent and may contain inaccuracies; please verify all suggestions before applying.

jiriOndrusek-agent and others added 4 commits October 30, 2026 13:30
…before the Spring based default

When no TransactionStrategy is configured, the component and endpoint now use
the single TransactionStrategy in the registry, and only then create the
Spring based DefaultTransactionStrategy. All four call sites go through
JpaHelper.resolveTransactionStrategy(), so DefaultTransactionStrategy is
created in one place only, which runtimes without Spring can replace.

JpaEndpoint.createTransactionStrategy() now returns TransactionStrategy.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ne TransactionStrategy

None of them is used then, so a misconfigured registry is not silent.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…honour autowiredEnabled

The transactionStrategy option of the component is now autowired. The
component and the endpoint look up the registry only when autowiring is
enabled. The component keeps its lookup, as a component added with
addComponent is initialized before it is autowired. The strategy picked
from the registry is logged at INFO.

The upgrade guide now says that the bean applies whatever the
EntityManagerFactory is, and that subclasses overriding
JpaEndpoint.createTransactionStrategy() must be recompiled. Adds a test
for the JpaMessageIdRepository default, and the endpoint test closes the
factory it creates.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…registry at DEBUG

The same level as the autowiring of endpoint options. A component created by
the CamelContext gets the bean by autowiring, which still logs it at INFO.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@jiriOndrusek-agent
jiriOndrusek-agent force-pushed the agent_CAMEL-26106-jpa-default-strategy branch from a6750d4 to 76c3f2c Compare October 30, 2026 13:56
@jiriOndrusek-agent

Copy link
Copy Markdown

Done: CAMEL-26106 lists only 4.24.0 now.

Generated with Claude Code on behalf of @JiriOndrusek

@jiriOndrusek-agent

Copy link
Copy Markdown

Rebased on main again: the 4.24 upgrade guide conflicted with the new camel-core and camel-quartz entries, and the camel-jpa entry now comes after them. The code is unchanged (same patch-ids for all 4 commits). camel-jpa passes locally (133 tests).

Generated with Claude Code on behalf of @JiriOndrusek

@davsclaus davsclaus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-checked after the rebase: the PR diff is the same as the one I reviewed on a6750d4 (only upgrade-guide context moved), all earlier points are addressed, threads resolved, and CAMEL-26106 fixVersions is now 4.24.0 only. LGTM.

Claude Code on behalf of davsclaus. This review was generated by an AI agent and may contain inaccuracies; please verify all suggestions before applying.

@davsclaus

Copy link
Copy Markdown
Contributor

Approved and ready to merge, but it now conflicts with main in camel-4x-upgrade-guide-4_24.adoc: #28566 (CAMEL-26341) was just merged and also added its entry at the end of the file. Could you rebase and keep both entries? I'll merge it once it is green again.

Claude Code on behalf of davsclaus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants