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

Fix relationships #25876

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ _%>
public <% if (reactive) { %>Mono<<% } %>List<<%= instanceType %>><% if (reactive) { %>><% } %> getAll<%= entityClassPlural %>(<% if (fieldsContainNoOwnerOneToOne) { %>@RequestParam(name = "filter", required = false) String filter<% } %><% if (implementsEagerLoadApis && fieldsContainNoOwnerOneToOne) { %>,<% } %><% if (implementsEagerLoadApis) { %>@RequestParam(name = "eagerload", required = false, defaultValue = "true") boolean eagerload<% } %>) {<%- include('get_all_stream_template', {viaService: viaService}); -%>
log.debug("REST request to get all <%= entityClassPlural %>");
<%_ if (viaService) { _%>
<% if (implementsEagerLoadApis && !dtoMapstruct) { %>
return <%= entityInstance %>Repository.findAllWithEagerRelationships()<% if (reactive) { %>.collectList()<% } %>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

findAllWithEagerRelationships should be used for collections where we should avoid multiple bags.
This error looks related to the repository since the relationships are not collections.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the best way to proceed with getting this merged? Is it good enough for now?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like findAllWithEagerRelationships is used bellow, but this is ignoring the service layer and executing the repository.
It's probably required to add a parameter at service layer to make it optional like it's in the rest layer.

<%_ } else { _%>
return <%= entityInstance %>Service.findAll()<% if (reactive) { %>.collectList()<% } %>;
qmonmert marked this conversation as resolved.
Show resolved Hide resolved
<%_ } _%>
<%_ } else if (dtoMapstruct) { _%>
<%= reactive ? 'Flux' : 'List' %><<%= persistClass %>> <%= entityInstancePlural %> = <%= entityInstance %>Repository.findAll();
<%_ if (reactive) { _%>
Expand Down
Loading