When Lazy loaded collections are accessed outside a transaction for bytecode enhanced entities, a NullPointerException is thrown by org.hibernate.engine.internal.AbstractEntityEntry.overwriteLoadedStateCollectionValue().
This exception occurs because when an Lazy Loaded collection is accessed outside a transaction, a temporary session is created to lazy load the collection and the loadedState of the EntityEntry for the PersistenceContext is set to null by;
org.hibernate.bytecode.enhance.spi.interceptor.LazyAttributeLoadingInterceptor.loadAttribute()
[https://github.com/ johnaohara hibernate /hibernate-orm/blob/master/hibernate-core/src/main/java/org/hibernate/bytecode/enhance/spi/interceptor/LazyAttributeLoadingInterceptor.java#L88|https://github.com/ johnaohara hibernate /hibernate-orm/blob/master/hibernate-core/src/main/java/org/hibernate/bytecode/enhance/spi/interceptor/LazyAttributeLoadingInterceptor.java#L88]
This was introduced by HHH-10708 |
|