Query Objects And Specifications

Expressing queries as objects that can be composed, named and tested — Query Object, Specification, criteria builders, derived repository methods and explicit SQL — and choosing between them per query rather than adopting one style everywhere. Use when repository interfaces have grown dozens of findByAAndBAndCOrderByD methods, when a search screen with optional filters is being built by concatenating strings, when a Specification chain has become unreadable or produces a query nobody can predict, when dynamic filtering is needed across several entities, when a criteria query is being written for something a single SQL statement would express, when reads are being forced through the aggregate, or when a query object is being proposed as an abstraction over the database. Does not cover the collection abstraction over domain objects (repository-pattern), fetch strategies and N+1 (orm-behavioral-patterns), where mapping metadata lives (metadata-mapping), or index design and pagination at the database level.

robsonkades b0c167e 4 files · 30.3 KB Updated

File contents

robsonkades/agent-skills/tree/main/skills/query-objects-and-specifications commit b0c167e83b

Frequently asked questions

npx skillmds@latest add robsonkades/query-objects-and-specifications