50,528
社区成员
发帖
与我相关
我的任务
分享
@Query(value="select b.* from book b left join book_cat_relation bcr on b.id=bcr.book_id where bcr.cat_id=?1 and b.title like ?2)",nativeQuery=true)//原生sql语句
Page<Book> findbookcat(Long catid,String title,Pageable pageable);
Caused by: org.springframework.data.jpa.repository.query.InvalidJpaQueryMethodException: Cannot use native queries with dynamic sorting and/or pagination in method public abstract org.springframework.data.domain.Page com.yes.biz.book.dao.BookDao.findbookcat(java.lang.Long,java.lang.String,org.springframework.data.domain.Pageable)
at org.springframework.data.jpa.repository.query.NativeJpaQuery.<init>(NativeJpaQuery.java:55)
at org.springframework.data.jpa.repository.query.JpaQueryFactory.fromMethodWithQueryString(JpaQueryFactory.java:72)
at org.springframework.data.jpa.repository.query.JpaQueryFactory.fromQueryAnnotation(JpaQueryFactory.java:53)
at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$DeclaredQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:144)
at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateIfNotFoundQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:212)
at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:77)
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.<init>(RepositoryFactorySupport.java:435)
at org.springframework.data.repository.core.support.RepositoryFactorySupport.g