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

Add support for QueryDSL and Query by Example projections through a fluent API in repositories #2228

Closed
spring-projects-issues opened this issue Oct 14, 2020 · 3 comments
Assignees
Labels
in: repository Repositories abstraction type: enhancement A general enhancement

Comments

@spring-projects-issues
Copy link

marcusvoltolim opened DATACMNS-1813 and commented

https://jira.spring.io/browse/DATAJPA-1796


Affects: 2.3.4 (Neumann SR4)

Reference URL: https://jira.spring.io/browse/DATAJPA-1796

@spring-projects-issues spring-projects-issues added in: repository Repositories abstraction type: enhancement A general enhancement labels Dec 30, 2020
@mp911de mp911de changed the title Add support for QueryDSL projections in JPA repositories [DATACMNS-1813] Add support for QueryDSL projections in repositories [DATACMNS-1813] Jul 28, 2021
@mp911de
Copy link
Member

mp911de commented Jul 28, 2021

See also:

As we face strong demand from various angles (Querydsl/Query-by-Example/JPA Specifications with projections, pagination queries, GraphQL to define eagerly loaded associations), we want to explore means how to define queries that leverage already existing base technology and are able to provide a certain degree of flexibility known from store-specific API (stream consumption, projections, inclusion/exclusion of properties).

@mp911de mp911de changed the title Add support for QueryDSL projections in repositories [DATACMNS-1813] Add support for QueryDSL and Query by Example projections in repositories Sep 7, 2021
@mp911de mp911de closed this as completed in 5111811 Oct 8, 2021
@mp911de mp911de added this to the 2.6 RC1 (2021.1.0) milestone Oct 8, 2021
@mp911de mp911de changed the title Add support for QueryDSL and Query by Example projections in repositories Add support for QueryDSL and Query by Example projections through a fluent API in repositories Oct 8, 2021
@dhunganawork
Copy link

dhunganawork commented Jun 12, 2022

This feature addition was very helpful. However, project() method does not seem to work. Or I might be doing somethin wrong.
Below is my code snippet. I want to select id column only, but my hibernate sql log shows all columns are being selected.

Page alerts = myRepository.findBy(predicate,
ffq -> ffq
.project("id")
.as(MyProjection.class)
.page(pageable)

    );

schauder added a commit that referenced this issue Jul 14, 2022
schauder added a commit that referenced this issue Jul 14, 2022
Incorporating feedback.

Original pull request #2655
See #2654
See #2228
@paulocagol
Copy link

Esta adição de recurso foi muito útil. No entanto, o método project () parece não funcionar. Ou posso estar fazendo algo errado. Abaixo está o meu trecho de código. Quero selecionar apenas a coluna id, mas meu log sql do hibernate mostra que todas as colunas estão sendo selecionadas.

Alertas de página = myRepository.findBy(predicado, ffq -> ffq .project("id") .as(MyProjection.class) .page(pageable)

    );

The same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: repository Repositories abstraction type: enhancement A general enhancement
Projects
None yet
4 participants