spring-projects / spring-data-relational

Spring Data Relational. Home of Spring Data JDBC and Spring Data R2DBC.
https://spring.io/projects/spring-data-jdbc
Apache License 2.0
737 stars 339 forks source link

JdbcAggregateOperations does not use columns parameter of Query #1803

Open Jul13nT opened 1 month ago

Jul13nT commented 1 month ago

With Spring Data JDBC (Spring Boot 3.3.0), when using JdbcAggregateOperations.findAll API with a Query object, the columns parameter of the query is not respected. When I specify some columns in the query, the returned object should have only theses properties populated. The logged query shows that Spring Data JDBC is using all columns in the select part.

I have made a reproduction repo: https://github.com/Jul13nT/spring-data-jdbc-query-columns You can run the CustomerRepositoryTest to see the problem.

This works fine with Spring Data R2DBC with R2dbcEntityTemplate.select.

stormlei commented 4 weeks ago

I also encountered the same problem