blaze-persistence icon indicating copy to clipboard operation
blaze-persistence copied to clipboard

Selecting a model subset (via fetches) leads to NPE when @EntityViewInheritance is involved

Open david-kubecka opened this issue 1 year ago • 1 comments

I don't have a simple reproducer for this but the situation is roughly following:

  • EV A contains (possibly deeply nested) a collection of EV B which has @EntityViewInheritance defined
  • I create an EntityViewSetting with fetches which don't contain the Bs collection
  • I apply the setting to the CB and fetch resultList

Expected: The query executes ok.

Actual: NPE in https://github.com/Blazebit/blaze-persistence/blob/08793f4ab72cd57762bb6d222ad1fa9421f23e22/entity-view/impl/src/main/java/com/blazebit/persistence/view/impl/objectbuilder/transformator/TupleTransformatorFactory.java#L135

Details: The classMappingIndex not present in the tuple corresponds to a "class type" select expression related to the Bs collection. That's why I think it's related to @EntityViewInheritance

david-kubecka avatar Apr 11 '23 09:04 david-kubecka

Update: There's a crude fix/workaround https://github.com/Blazebit/blaze-persistence/pull/1723

david-kubecka avatar Apr 11 '23 09:04 david-kubecka