davsclaus opened a new pull request, #24790: URL: https://github.com/apache/camel/pull/24790
## Summary `JpaConsumer.processBatch()` calls `createPreDeleteHandler()` directly instead of the cached accessor `getPreDeleteHandler()`, causing two bugs: 1. A user-supplied `preDeleteHandler` (configured via the `@UriParam` option on `JpaEndpoint`) is **never invoked** — `createPreDeleteHandler()` always re-derives the handler from the `@PreConsumed` annotation scan, completely bypassing anything set via `setPreDeleteHandler()`. 2. `createPreDeleteHandler()` runs `AnnotationHelper.findMethodsWithAnnotation()` — a reflective scan of the entity's methods — for **every entity of every poll batch**, instead of once per consumer lifetime. The `@Consumed`/`getDeleteHandler()` counterpart a few lines below already uses the correct cached accessor pattern. ## Fix Changed line 199 from `createPreDeleteHandler()` to `getPreDeleteHandler()`, mirroring the existing `getDeleteHandler()` pattern. ## Test Added `JpaPreDeleteHandlerTest` that sets a custom `preDeleteHandler` programmatically on the endpoint and verifies it is actually invoked when entities are consumed. _Claude Code on behalf of davsclaus_ -- 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]
