Skip to content

Use tuple queries for projections using QueryDSL and Query by ExampleΒ #2600

@kekhuai

Description

@kekhuai

I'm implementing a dynamic query with following code.

userRepository.findBy(QUser.user.id.isNotNull(), q -> q.project("username").as(UserWithUsernameOnly.class).all());

But the generated query still select all of the columns.

select user0_.id as id1_0_, user0_.create_date as create_d2_0_, user0_.created_by as created_3_0_, user0_.last_modified_by as last_mod4_0_, user0_.last_modified_date as last_mod5_0_, user0_.password as password6_0_, user0_.username as username7_0_, user0_.version as version8_0_ from users user0_ where user0_.id is not null

I expect the generated query should only select the specified column.

Here is the reproducible repo.
https://github.com/kekhuay/special-palm-tree

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions