【发布时间】:2014-09-12 21:04:36
【问题描述】:
我有这个请求与queryDSL 合作得很好:
Iterable<AO> query_result = new JPAQuery(entityManager).from(ao)
.leftJoin( ao.lots , lot )
.leftJoin( ao.acs , ac )
.where(where).distinct()
.list(ao);
但是如果我们将它与spring data jpa 一起使用,它的等价物是什么
ao_respository.findAll(Predicate arg0, Pageable arg1);
因为我想返回一个Page 并且只使用querydsl 它不会实现Page 没有spring data jpa。
我尝试将我的 where 放入 Predicate arg0 但我遇到了这个异常
Undeclared path 'lot '. Add this path as a source to the query to be able to reference it
其中lot 被声明为QLot lot = QLot.lot;
【问题讨论】:
-
我也在寻找答案。如何将您的问题改写为“如何使用 Spring Data 和 QueryDSL 执行带有分页的 JPAQuery”……我知道您有标签,但标题无助于获得答案。
-
我更新了标题 ;)
-
我提出了一个解决方案,但最后有一个警告
标签: spring hibernate spring-data spring-data-jpa querydsl