Spring Data JPA - Pass column name and value as parameters

前端 未结 3 782
长发绾君心
长发绾君心 2020-12-04 01:31

I just wanted to know how to pass column name and its value to @Query annotation in Spring Data JPA.

Basically column names will be static and we used to put every c

3条回答
  •  时光说笑
    2020-12-04 01:45

    You can use nativeQuery=true like this..

    @Query(value = "select c from Calendar c where c.:calendarDay=:value", nativeQuery = true)
    List getPersonName(@Param("calendarDay") String calendarDay, @Param("value") String value);
    

提交回复
热议问题