In this video, I'm showing you what is the best way to fetch entity associations when using JPA and Hibernate.
First, I will explain how the FetchType.EAGER and FetchType.LAZY strategies work when using JPA and Hibernate.
Afterward, you will learn how you can fetch multiple associations, no matter if those are @ManyToOne, @OneToOne, or collections.
Next, I will discuss about the N+1 query issue and see what's the best way to prevent it.
In the end, I will cover the LazyInitializationException topic and see why we should avoid the Open Session in View anti-pattern.