Review: Spring Data JPA Reference

TL;DR: Recommended?
Really good read! ⭐️⭐️⭐️⭐️⭐️️
Read Online as:

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 builder. So:

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 Stream<T> and Future<T> entities 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.

Great work @olivergierke and contributors. There seems to be a good book on that topic, too: Spring Data (O'Reilly Media) - that might be my next.

In java, read, spring, spring-boot, spring-data by @ 31 Mar 2016

comments powered by Disqus

Recent Files


Recent Dev-Articles

Read recently