We can select specific columns by writing custom @Query methods in our Repository Interface. However, I don\'t want to write so many methods for different properties.
<
The current spring data jpa specification executor is limited to criteria in the where clause, so you can't change the selected columns, it's implicitely limited to full entities only (take a look at JpaSpecificationExecutor interface documentation). You'll have to go with a custom repository implementation, or move to named queries-
Spring Data JPA and Querydsl to fetch subset of columns using bean/constructor projection