intermediateJPQL, Native Queries, Specifications & Criteria API
When would you reach for a Specification instead of a derived query method or JPQL?
When a query's conditions are genuinely dynamic at runtime — for example, a search form where the user may supply any combination of optional filters. A fixed derived method name or JPQL string can't express "this condition, but only if it was supplied"; Specifications compose predicates conditionally at runtime.
This is a Pro chapter
Sign in, then upgrade to Pro or Power to unlock this and the full Spring Ecosystem Mastery library.
When would you reach for a Specification instead of a derived query method or JPQL?