jpa语句报 org.springframework.dao.InvalidDataAccessApiUsageException: Parameter with that position [2] did not exist; nested exception is java.lang.IllegalArgumentException: Parameter with that position
@Query("SELECT area from Area AS area WHERE area.state=0 AND area.name like %?1% ")
Area findByIsCityAndNameLike(int iscity,String name);
第一反应: 将 AND area.name like %?1% 后的 1要改成2 但是依然报错
仔细反应了 @Query("SELECT area from Area AS area WHERE area.state=0 AND area.isCity = ?1 AND area.name like %?2% ") 就正确了