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
The only dynamic parameter Spring JPA supports is #{#entityName}
. Dynamic column names in @Query
annotations are not supported., and that is what you are trying to accomplish.
Your only option is to construct a query manually using either QueryDSL, Specifications or Criteria API or simply by building a query string and passing it to your EntityManager. Regardless, you'll have to write code for that.
See, for instance: