After reading the spring boot reference in november, I wanted to know more in depth knowledge of spring data. That's why I read the official spring data jpa reference.
Something new to me is, that you can use
_ in spring data repository interface names to give a hint to the query
List<Person> findByAddress_ZipCode(ZipCode zipCode); // resolves to address.zipCode or address.zip.code
is more explicit then:
List<Person> findByAddressZipCode(ZipCode zipCode); // resolves to either addressZipCode, address.zipCode or address.zip.code
Even though the
_ (underscores) look ugly ;).
At the end checkout the
Appendix C: Repository query keywords, to see what magic words you can use in your Interface definitions. Also
Appendix D: Repository query return types is very interesting - you can use even
in the interfaces!
With 69 pages it does not go too much into detailed use cases, but provides a sufficient and basic understanding what is possible with spring data and what's not. I would suggest everyone to check that out, before digging deeper into special spring data implementations like elasticsearch or mongodb.