A query is configuration, and the read side stays separate
Commands write through JPA. Queries read through MyBatis, from views shaped for reading. A named query is a JSON definition and a select: post JSON to /q/{name} and get back rows, paging and the actions allowed on each row, already filtered by who you are.
Exchange
Payload
Read from views, not entities
The select reads a view where joins and calculations are done up front, so a filter on a customer's last name or a computed balance costs nothing extra. The entity tables stay the commands' business.
Security in the query
Each query carries its own acls, per tenant. Relationship filters, such as the caller and their reportees, are added on the server and joined against security tables kept in the same database.
JSON in, JSON out
A grid or an AI agent sends filters as JSON and gets rows as maps; no Java DTO is required on either side. Java callers can still map rows to DTOs, and each query is also an MCP tool.