Envers cannot process deletion of child entity for ManyToOne relation


It worked fine till version 5.4.10.Final, but with beginning with 5.4.11.Final stopped working. Just for information: we found one change related to that in 5.4.11 is

The problems happens in unit test. We delete data from parent and from child entities. Both uses Envers.
The definition of relation to parent in child:

Hibernate deletes parent entity. Then Envers during processing of child entity tries to find the parent in database (it is also not in cache any more) and throws ObjectNotFoundException:

It worked fine for the last 5 years and stopped to work now.
Following newly added in 5.4.10 lines of code from ToOneIdMapper causes a problem:

Thanks & best regards.


JDK 8, Win, OracleDB


Daniel Victor Ion
October 13, 2020, 6:29 PM

We are also experiencing the same issue. We have been trying to update from an older hibernate version (5.2.10) and unfortunately we get the same LazyInitializationExceptions. This only happens in the versions following 5.4.10.

This issue has not been fixed in the latest release (5.4.22 atm).

The stack trace is identical to the one in the description above.

Daniel Victor Ion
October 13, 2020, 6:35 PM
Devon Ferns
October 15, 2020, 7:17 PM

Is anyone working on fixing this?

I believe we are bit by this bug as well

javax.persistence.PersistenceException: org.hibernate.HibernateException: HHH000479: Collection [com.xxx.hibernate.mappings.MyObject.myList] was not processed by flush(). This is likely due to unsafe use of the session (e.g. used in multiple threads concurrently, updates during entity lifecycle hooks). at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:154) at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:181) at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:188) at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1367) at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1350) at

When saving, MyObject is a hibernate proxy object. myList in MyObject is mapped as FetchType.LAZY as well.

In 5.4.10 this works fine. In 5.4.11+ this error is thrown in many areas for audited entities with this condition of a proxy object with an associated lazy loaded collection.

Our stack trace is not the same, but I think it is caused by the same issue:

-envers finds a lazy proxy object when auditing an entity class. This proxy object also has a lazy loaded list mapped. Envers tries to load this object but triggers a check in hibernate that throws this exception.

Please advise your plan/timeline on whether this can & will be fixed. 5.4.10 is nearly 1 year old at this point so being stuck on such an old version is not ideal.

Luke Chen
November 3, 2020, 2:21 PM

@Chris Cranford, if you don’t mind, I’ll take it over since our project also blocked by this issue.

Also, could someone please attach a runnable test case using the test templates at ? That would help a lot. Thanks.

Luke Chen
November 17, 2020, 7:49 AM

PR is ready for review:




Luke Chen


Maxim Schelest

Fix versions




Suitable for new contributors


Requires Release Note


Pull Request




Worked in



Affects versions