[Email #4 of 4] X-ray vision for your persistence layer
I show one feature in almost all my conference talks, and it’s always the one my listeners are the most eager to try. They sometimes even tell me that they already tried it when we meet later that same day in between talks.
It gives you X-ray vision for your persistence layer and is the only thing you need to understand how it works.
And that’s crucial. As I explained yesterday, the persistence layer is the engine of your application that determines how well your business logic performs. And understanding your persistence layer and the features your framework has to offer is the first step to building an efficient engine for your application.
That’s why I think it’s a shame that not more developers know about this feature. Instead, I hear many complaints that Hibernate or Spring Data JPA is a black box or that the executed SQL statements are totally unpredictable.
But that doesn’t have to be the case. Hibernate clearly knows what it’s doing, and it can tell you all about it. And that makes understanding and improving your persistence layer so much easier.
That’s, of course, also the case if you add Spring Data JPA on top of Hibernate.
Here is an example of the log output Hibernate can share for each session.
As you can see, this gives you a quick overview of all executed SQL statements, cache interactions, JDBC batches, and flush operations. I explain all of this in more detail in this article.
Trust me; you should give it a try. You’ll see how your application’s engine - your persistence layer - works so that you can understand and improve it.
Speak soon,
Thorben
PS: I will email you tomorrow with something that will help you bring your Java persistence skills to the next level.
Check out the latest tutorials on the blog.
Stay up to date with the latest releases and features in the Java persistence world. Read the blog.Watch my tutorials on YouTube.
You prefer videos over written content? Then my YouTube channel is the right place for you.Get my Hibernate Tips ebook.
The ebook is packed with ready-to-use solutions to help you solve your next Hibernate problem even quicker. Get it here.Join the Persistence Hub.
The Persistence Hub teaches you everything you need to know on your journey to becoming a Java persistence expert. Get access to video courses, Expert Sessions with amazing guests, monthly Java Persistence News, and more. Become a member.