Question Details

No question body available.

Tags

spring-boot hibernate spring-mvc

Answers (1)

March 18, 2026 Score: 1 Rep: 876 Quality: Low Completeness: 50%

The "empty PersistentBag" issue in a @Transactional context might be caused by Persistence Context Pollution (First-Level Cache). Let's try to force Hibernate to "forget" the cached entities so it must use the results of your JOIN FETCH query.

@PersistenceContext
private EntityManager entityManager;

@Transactional public void yourMethod() { // ... previous logic that might have loaded the entity ... entityManager.clear(); List results = repository.findAllWithChildren(); }