Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
david-kubecka opened this issue Apr 11, 2023 · 1 comment
Labels
component: entity-view kind: bug worth: high Implementing this has a high worth
Milestone

Comments

@david-kubecka
Copy link
Contributor

david-kubecka commented Apr 11, 2023

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

if (Arrays.binarySearch(subtypeIndexes, ((Number) tuple[classMappingIndex]).intValue()) >= 0) {

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

@beikov beikov added kind: bug component: entity-view worth: high Implementing this has a high worth labels Apr 11, 2023
@beikov beikov added this to the 1.6.x milestone Apr 11, 2023
david-kubecka added a commit to david-kubecka/blaze-persistence that referenced this issue Apr 11, 2023
For some unknown reason a classMappingIndex sometimes
points to a non-present field in the tuple (filtered
via fetches mechanism). The correct fix should be somewhere
else but that this is probably good enough - just don't
perfomr any tuple transformation for non-present fields.

Also, fix a small bug in hasSubFetches. The wrongly
implemented equality check lead to overfetching.
@david-kubecka
Copy link
Contributor Author

Update: There's a crude fix/workaround #1723

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: entity-view kind: bug worth: high Implementing this has a high worth
Projects
None yet
Development

No branches or pull requests

2 participants