|
In case when entity has collection with eager loading mapping like
@OneToMany(mappedBy = "parent", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
and entities are enhanced with configuration
cfg.setProperty( Environment.ENABLE_LAZY_LOAD_NO_TRANS, "true" );
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. TestTask.patch
|