Spring Data JPA Specification to Select Specific Columns

前端 未结 3 1993
遇见更好的自我
遇见更好的自我 2020-12-11 02:08

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.

<
3条回答
  •  遥遥无期
    2020-12-11 02:23

    I tried this, but it returns the entire object all the time.

    This method returns single entity matching given specification. Please check here

    According to my understanding this is the correct way. U can access the properties of the entity as normal (Eg. MyInfo.getIdProperty())

提交回复
热议问题