Spring Data JPA’s repositories provide most of the database operations for you. That makes working with Spring Data JPA very comfortable but it also increases the importance of a good logging configuration. If you don’t implement your database operations yourself, you at least need to make sure that you know which operations get performed.
The best way to monitor all executed SQL statements during development is to use the right logging configuration for the persistence provider used by Spring Data JPA. The persistence provider does all the heavy lifting. It’s responsible for executing all queries, detecting and persisting dirty entities, handling caching, and providing lazy loading for managed associations. And it’s also the best component to measure and report all these operations.
When using Spring Boot, Spring Data JPA uses Hibernate as its persistence provider by default. So, let’s take a closer look at a development configuration that provides you with the necessary insides and a configuration for production that keeps the overhead as low as possible.
Like my channel? Subscribe!
➜ http://bit.ly/2cUsid8
Read the accompanying post: https://thorben-janssen.com/spring-data-jpa-logging/
Want to connect with me?
Blog: https://thorben-janssen.com/
Twitter: https://twitter.com/thjanssen123
Facebook: https://www.facebook.com/thorbenjanssenofficial
Linkedin: https://www.linkedin.com/in/thorbenjanssen/
2 Comments