KamoCRM

The mortgage pipeline loads in a handful of queries, and a deal can be renamed and take a second loan

PerformanceSecurityService
Shipped
October 21, 2026 at 6:11 PM UTC
Author
Kamo
Commit
7ca04ac

The pipeline's two reads were N+1 on the round trip: - GET /mortgage-apps loaded plain AppMortgage rows, and each one then fired a SELECT per inverse @OneToOne (loanFile, loan, property, loanOriginator). Hibernate cannot proxy or batch the mappedBy side, so default_batch_fetch_size never helped: four round trips per application. It now fetch-joins them. - GET /mortgage-apps/transactions ran `select lf from LoanFile` once PER deal, and every LoanFile it hydrated eagerly dragged in its AppMortgage (non-lazy owning one-to-one) and that app's four one-to-ones. The rollup is now one scalar projection for every deal at once; no entity is hydrated. The transaction summary also carries `terminal` (completed/cancelled, the pipeline's "past" view), the assigned loan officer and the date the deal was opened, and two deal-management endpoints join the existing LO assignment: - PUT **************** rename (LOS write right) - POST **************** add a blank loan to the deal (take-application right); the loan inherits the deal's account The HQL is parsed against the shared-library mapping on this service's Hibernate in a test, since nothing else checks string-built queries before production.

All changes

Like what you see shipping?

All of it arrives in your workspace on its own. Start on the free plan and read this page again in a month.

Start Free ForeverView Pricing