In case when entity has collection with eager loading mapping like
and entities are enhanced with configuration
there is error with loading entity by session.load( Parent2.class, parentID ):
...
Caused by: org.hibernate.PropertyAccessException: Exception occurred inside setter of org.hibernate.test.bytecode.enhancement.lazy.Parent2.children
at org.hibernate.property.access.spi.EnhancedSetterMethodImpl.set(EnhancedSetterMethodImpl.java:81)
...
Caused by: java.lang.reflect.InvocationTargetException
...
org.hibernate.property.access.spi.EnhancedSetterMethodImpl.set(EnhancedSetterMethodImpl.java:49)
...
Caused by: java.lang.NullPointerException
at org.hibernate.engine.internal.StatefulPersistenceContext.getLoadedCollectionOwnerOrNull(StatefulPersistenceContext.java:747)
...
In attachment is junit test case to reproduce it.
The issue is already fixed in the meantime, so it can be closed. Test unit is in pull request