Commits
Tarun Sukhani authored fbe20c62228
perf(jpa): lazy EM acquisition in withTransaction (PF-106) JPA.withTransaction used to eagerly open an EntityManager and (for non-readonly contexts) begin a transaction across every registered persistence unit on request entry. Each request grabbed a HikariCP connection for its full duration, even when the handler touched no database — under virtual-thread scheduling, the connection pool (default 30) became the concurrency ceiling. Switch to lazy acquisition: withTransaction installs a lightweight JPAContext placeholder per persistence unit with materialized=false, and the first JPA.em(name) call materializes the EM and begins the resource-local tx. End- of-request commit/close paths skip unmaterialized placeholders so a handler that never calls em() never leases a connection. The public JPA.em() and JPA.withTransaction() signatures are unchanged — laziness is invisible to callers. Opt-in info log at jpa.lazy.log=true reports materialized vs placeholder counts per request for operators verifying which routes are DB-free. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>