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% ") 就正确了
文章来自:http://www.cnblogs.com/liduanwen/p/5630222.html
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3