Decorator pattern in a Spring Boot project
Anyone who has worked with Hibernate has already faced the LazyInitializationException. It occurs when trying to access an association that hasn’t been fetched along with an entity. To avoid this, the required association(s) must be fetched within the same database transaction. Fetching several to-one associations can be achieved in one single JPQL query via several JOIN FETCH clauses or by defining an appropriate EntityGraph. For to-many associations neither of those two approaches is possible: Hibernate […]