I am writing an insert query inside @Query annotation in a Spring application with PostGreSQL. So I am extending CRUD repository inside an interface that I have written.
@Repository
public interface PostGreRepository extends CrudRepository<FoodDetails,Long> {
@Modifying
@Query(value="insert into fooddetails(person_id,food_desc) select id,food_desc from person,food where id = " +
"person_id",nativeQuery = true)
void insertIntoPostGre();
}
Now I have the requirement to keep the query as a parameter in the application because it might change later. I cannot use @Value annotation inside an interface. So how can I parameterize this? Ideas?