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

Entity view subfetching creates empty containers for unfetched collection attributes #2001

Open
Mobe91 opened this issue Feb 16, 2025 · 1 comment

Comments

@Mobe91
Copy link
Contributor

Mobe91 commented Feb 16, 2025

Consider e.g. the following entity view:

public interface PrimitiveDocumentView {

    @IdMapping
    public long getId();

    @Mapping(fetch = FetchStrategy.SUBSELECT)
    public Map<Integer, PrimitivePersonView> getContacts();

}

When fetching this entity view we specify fetches that exclude contacts:

var setting = EntityViewSetting.create(PrimitiveDocumentView.class);
setting.fetch("id");
evm.applySetting(setting, cbf.create(em, PrimitiveDocument.class));

For fetched entity views getContacts() will return an empty map instead of null. This also happens for other collection mappings.

@Mobe91
Copy link
Contributor Author

Mobe91 commented Feb 16, 2025

For fixing this we should turn the IndexedTupleListTransformer into an IndexedTupleListTransformerFactory which can access entity view setting metadata and thus can consider fetched entity view paths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant