JPA Association Fetching Validator
Introduction In this article, I’m going to show you how we can build a JPA Association Fetching Validator that asserts whether JPA and Hibernate associations are fetched using joins or secondary queries. While Hibernate does not provide built-in support for checking the entity association fetching behavior programmatically, the API is very flexible and allows us to customize it so that we can achieve this non-trivial requirement.
N+1 query problem with JPA and Hibernate
Introduction In this article, I’m going to explain what the N+1 query problem is when using JPA and Hibernate and what’s the best way to fix it. The N+1 query problem is not specific to JPA and Hibernate, as you can face this issue even if you are using other data access technologies.
How to avoid the Hibernate Query Cache N+1 issue
Introduction I recently answered this question on the Hibernate forum, and since it’s a very good one, I decided to turn it into an article. In this post, we will describe how the N+1 query issue is generated when using the second-level Hibernate Query Cache.