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 1 commit into
base: main
Choose a base branch
from
Open

Fix relationships #25876

wants to merge 1 commit into from

Conversation

qmonmert
Copy link
Contributor

Fix #25846


Please make sure the below checklist is followed for Pull Requests.

When you are still working on the PR, consider converting it to Draft (below reviewers) and adding skip-ci label, you can still see CI build result at your branch.

@@ -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.

@qmonmert qmonmert marked this pull request as ready for review June 21, 2024 17:51
@@ -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()<% } %>;
<%_ } else { _%>
return <%= entityInstance %>Service.findAll()<% 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.

Service layer should not be bypassed.

Suggested change
return <%= entityInstance %>Service.findAll()<% if (reactive) { %>.collectList()<% } %>;
return <%= entityInstance %>Service.findAll(<% if (implementsEagerLoadApis) { %>eagerload<% } %>)<% if (reactive) { %>.collectList()<% } %>;

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

Successfully merging this pull request may close these issues.

Vue: Blank Parent column in Child entity list for both one-to-one and many-to-one relationships
3 participants