79331950

Date: 2025-01-06 02:40:30
Score: 0.5
Natty:
Report link

Although this is an old post, I thought it might pay to leave the solution that I have implemented in case someone else trips over the problem like I have.

This seems to happen because the entity manager is not managed and therefore not closed. To get around it declare the entity manager into its own variable and then close it once done.

EntityManager entityManager = factory.createEntityManager();
List results2 = AuditReaderFactory.get(entityManager).createQuery()
        .forRevisionsOfEntityWithChanges( Customer.class, false )
        .add( AuditEntity.id().eq( 3014l ) )
        .getResultList();
entityManager.close();
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: Matthew