jiriOndrusek-agent commented on code in PR #28496:
URL: https://github.com/apache/camel/pull/28496#discussion_r4379534649
##########
components/camel-jpa/src/main/java/org/apache/camel/processor/idempotent/jpa/JpaMessageIdRepository.java:
##########
@@ -58,7 +58,7 @@ public class JpaMessageIdRepository extends ServiceSupport
implements Idempotent
private boolean sharedEntityManager;
public JpaMessageIdRepository(EntityManagerFactory entityManagerFactory,
String processorName) {
- this(entityManagerFactory,
createDefaultTransactionStrategy(entityManagerFactory), processorName);
+ this(entityManagerFactory, JpaHelper.resolveTransactionStrategy(null,
entityManagerFactory), processorName);
Review Comment:
Yes, this is intentional. The repository has no `CamelContext`: it is not
`CamelContextAware`, and the 2-arg constructor resolves the strategy into a
final field (`JpaMessageIdRepository.java:56-62`), as before.
A registry lookup here would also change behaviour. A registry strategy,
maybe bound to another `EntityManagerFactory`, would replace the repository's
own one. With a context, `DefaultTransactionStrategy` would also start using
the registry's `PlatformTransactionManager`
(`DefaultTransactionStrategy.java:65-97`).
To use a specific strategy, pass it to the 3-arg constructor
(`JpaMessageIdRepository.java:64`).
_Generated with [Claude Code](https://claude.com/claude-code) on behalf of
@JiriOndrusek_
##########
components/camel-jpa/src/main/java/org/apache/camel/processor/keyvalue/jpa/JpaKeyValueRepository.java:
##########
@@ -476,7 +477,7 @@ public void setDeserializationFilter(String
deserializationFilter) {
@Override
protected void doInit() throws Exception {
if (transactionStrategy == null) {
- transactionStrategy = new DefaultTransactionStrategy(null,
entityManagerFactory);
+ transactionStrategy = JpaHelper.resolveTransactionStrategy(null,
entityManagerFactory);
Review Comment:
Yes, for the same reasons. It is not `CamelContextAware` either, and the
cache EIP starts it without a context (`CacheProcessor.java:212`), so a lookup
would work only in some setups. Set its `transactionStrategy` option to use a
specific strategy.
_Generated with [Claude Code](https://claude.com/claude-code) on behalf of
@JiriOndrusek_
--
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]