springboot采坑之jpa-sql语句

感觉是个bug啊

//分页所有保存成功的库
    @Query(value = "SELECT * from mongodbdata where save = 'true' limit ?1 ,?2;", nativeQuery = true)
    List<MongoDbdata>  selectAllSaveMongoByPage(int start,int limit);

给我报org.hibernate.QueryException: JPA-style positional param was not an integral ordinal; nested exception is java.lang.IllegalArgumentExceptio   这样的错误

我的解决办法。  在sql语句?1,?2 后面加个空格

//分页所有保存成功的库
    @Query(value = "SELECT * from mongodbdata where save = 'true' limit ?1 ,?2 ;", nativeQuery = true)
    List<MongoDbdata>  selectAllSaveMongoByPage(int start,int limit);

转 https://blog.csdn.net/lin_tuer/article/details/78436077

原文地址:https://www.cnblogs.com/fangyuandoit/p/13713836.html