When the org.hibernate debug level is set to at least DEBUG, and
hibernate.jpa.compliance.proxy property is set to true hibernate throws an exception on transaction commit on rather simple entity graphs. (Even when the transaction does not modify the state)
When setting only the debug level or the property, hibernate works correctly.
The Excpetion thrown is either a ConcurrentModificationExcption in EntityPrinter.java,
org.hibernate.HibernateException: HHH000479: Collection [org.hibernate.bugs.MvnoOpcio.mvnoBillingAgreementekDefaultOpcioja] 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).
Depending on the environment, the PersistenceContext complexity, and whether the Iterator in EntityPrinter can detect the change in the underlying Collection.
This seems to be related to HHH-2218, as the EntityPrinter.java class seems to trigger an Entity load ( as can be seen in the attached log fragment)
Hibernate 5.3.7 in Wildfly 15.0.1.Final
CentOS Linux release 7.6.1810 (Core)
DB independent (triggers both with mysql and H2)