Skip to content

FetchableFluentQuery ignores 'project' #2909

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

Closed
trks1970 opened this issue Apr 11, 2023 · 1 comment
Closed

FetchableFluentQuery ignores 'project' #2909

trks1970 opened this issue Apr 11, 2023 · 1 comment
Labels
status: duplicate A duplicate of another issue

Comments

@trks1970
Copy link

trks1970 commented Apr 11, 2023

spring-data-jpa: 3.0.4

when using JpaSpecificationExecutor.findBy(Specification, FetchableFluentQuery)

and looking at the SQL query generated by hibernate I see that all the entity attributes are queried, not just the ones defined in the project statement of the FetchableFluentQuery.

Executing:

Set<IdProjection> children =
        new HashSet<>(
            jpaChildEntityRepository.findBy(
                ChildEntitySpecification.parent(id),
                fetchableFluentQuery ->
                    fetchableFluentQuery.as(IdProjection.class).project(ChildEntity_.ID).all()));

generates the SQL:

select c1_0.id,c1_0.description,c1_0.name,c1_0.parent_id,c1_0.revision from child c1_0 where c1_0.parent_id=?

complete code is available at: GitHub
ParentServiceTest.deleteWithChildren

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 11, 2023
@schauder
Copy link
Contributor

Duplicate of #2721

@schauder schauder marked this as a duplicate of #2721 Apr 11, 2023
@schauder schauder closed this as not planned Won't fix, can't repro, duplicate, stale Apr 11, 2023
@schauder schauder added status: duplicate A duplicate of another issue and removed status: waiting-for-triage An issue we've not yet triaged labels Apr 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants