Efficient JPA Querying
- Use join fetch
- Named Entity Graphs https://blog.ippon.tech/boost-the-performance-of-your-spring-data-jpa-application/
- graph definition can be on the query
- graph definition can be on the entity so that other methods can re use it.
- Annotation Named Entity : Used to specify the path and boundaries for a find operation or query.
- Use appropriate fetch types (lazy or eager)
MultipleBagFetchException
- Caused by: org.hibernate.loader.MultipleBagFetchException: cannot simultaneously fetch multiple bags: [com.jpa.experiments.entity.TaskEntity.aspects, com.jpa.experiments.entity.AspectEntity.anchors]