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

 

posted @ 2019-03-12 10:47  妖君你好  阅读(373)  评论(0编辑  收藏  举报