vignesh-manel commented on PR #28630:
URL: https://github.com/apache/camel/pull/28630#issuecomment-6473043643
@davsclaus thanks for the review. Both points are done in fa54e0f.
**Blocker, `isEntity` before the lock:** done as you suggested. `lockEntity`
returns `true` for a result that is not an entity before calling
`entityManager.lock`. The catch block now returns `false`, and its old fallback
for native-query arrays (with the TODO) is gone, because arrays no longer reach
the lock. A new test, `testNoLockIsAttemptedForAValueThatIsNotAnEntity`, passes
a mock `EntityManager` on the real metamodel. It checks that `lock` is never
called for a `String` or an `Object[]` and is still called for an entity. It
failed before the change ("Never wanted here", with `lock` called for both
values) and passes after.
I also ran it on Hibernate, which my first round missed:
- On the previous head (a05469717edf), with `-Dhibernate` (Hibernate 7.4.13)
and DEBUG logging, each lock of the `String` failed with
`DetachedObjectException: Given entity is not associated with the persistence
context`, as you read it.
- In the module's Hibernate test setup (`LocalEntityManagerFactoryBean` +
`JpaTransactionManager`), the exception reached `lockEntity` as the raw
`DetachedObjectException`, not as an `IllegalArgumentException`. The poll still
committed and the test passed, so I could not reproduce the rollback-only
failure there. Another bootstrap, such as Spring Boot's, may still convert it.
Either way the call is gone now.
**WARN per row:** done. The "Cannot auto-delete" WARN is logged once per
consumer and then at DEBUG. In the test (two polls of two rows) it appears once
in the log, and the upgrade-guide entry now says so.
On fa54e0f, the full camel-jpa suite passes after `mvn clean` on both
OpenJPA and Hibernate: 52 classes, 124 tests, 0 failures, 1 skipped. I also
corrected a count in the PR description. An earlier version said 53 classes,
because a run without `clean` counted the report of a temporary test I had
deleted.
I'll re-request your review once CI is green on fa54e0f.
_Claude Code on behalf of vignesh-manel_
--
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]