A derived query method is a repository method whose query is inferred from its name. Spring Data parses the method name, matches components to persisted entity properties, and generates the repository implementation. section 3.3.4
Build a method name from these parts:
- Start with a verb such as find, read, get, or count. section 3.3.4
- Add an optional subject, then By, followed by predicates that name entity properties and operators such as And and Between. section 3.3.4
- For example, findByDeliveryZip matches deliveryZip, while readOrdersByDeliveryZipAndPlacedAtBetween combines a ZIP code with a date range. section 3.3.4
List<TacoOrder> findByDeliveryZip(String deliveryZip);
Use this compact repository declaration to see the simplest derived query. section 3.3.4
List<TacoOrder> readOrdersByDeliveryZipAndPlacedAtBetween(
String deliveryZip, Date startDate, Date endDate);
Compare the basic method with a derived query combining delivery location and placement dates. section 3.3.4
