Loading set of @OneToMany association with @Loader and @NamedNativeQuery causes NPE

Description

Trying to load the entities of a @OneToMany relation with the @Loader annotation and a @NamedNativeQuery causes a NullPointerException

java.lang.NullPointerException: null
at org.hibernate.collection.internal.PersistentBag.size(PersistentBag.java:261)
at org.hibernate.bytecode.enhance.spi.interceptor.LazyAttributeLoadingInterceptor.takeCollectionSizeSnapshot(LazyAttributeLoadingInterceptor.java:186)
at org.hibernate.bytecode.enhance.spi.interceptor.LazyAttributeLoadingInterceptor.access$000(LazyAttributeLoadingInterceptor.java:36)
at org.hibernate.bytecode.enhance.spi.interceptor.LazyAttributeLoadingInterceptor$1.doWork(LazyAttributeLoadingInterceptor.java:111)
at org.hibernate.bytecode.enhance.spi.interceptor.Helper.performWork(Helper.java:97)
at org.hibernate.bytecode.enhance.spi.interceptor.LazyAttributeLoadingInterceptor.loadAttribute(LazyAttributeLoadingInterceptor.java:76)
at org.hibernate.bytecode.enhance.spi.interceptor.LazyAttributeLoadingInterceptor.fetchAttribute(LazyAttributeLoadingInterceptor.java:72)
at org.hibernate.bytecode.enhance.spi.interceptor.LazyAttributeLoadingInterceptor.intercept(LazyAttributeLoadingInterceptor.java:61)
at org.hibernate.bytecode.enhance.spi.interceptor.LazyAttributeLoadingInterceptor.readObject(LazyAttributeLoadingInterceptor.java:296)

Environment

None

Assignee

Unassigned

Reporter

Daniele Bottelli

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Feedback Requested

2018/10/05

Feedback Requested By

Guillaume Smet

Components

Affects versions

Priority

Minor
Configure