Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Spring Data

You're reading from  Spring Data

Product type Book
Published in Nov 2012
Publisher Packt
ISBN-13 9781849519045
Pages 160 pages
Edition 1st Edition
Languages
Author (1):
Petri Kainulainen Petri Kainulainen
Profile icon Petri Kainulainen
Toc

Chapter 4. Adding Custom Functionality to JPA Repositories

We have learned how we can manage our entities and create database queries with Spring Data JPA. We have also learned how we can sort and paginate query results. However, if we take a purist architectural point of view, we notice that the described solutions are not following the separation of concerns principle. In fact, our service layer contains code that reveals the inner workings of our repository layer.

This is a trade off between architectural purity and productivity. As always, this choice has some consequences. If we have to migrate our application away from Spring Data JPA, we have to make changes to both the service and repository layer. However, how many times have we heard that the repository layer of an application has to be changed so radically? Exactly. These situations are very rare. Thus, this risk is worth taking when the reward is high.

The techniques described in this chapter can be used to hide the implementation...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at ₹800/month. Cancel anytime}