Re: How to convert JPAQuery to Predicate

534 views
Skip to first unread message

Timo Westkämper

unread,
Nov 19, 2012, 3:35:22 AM11/19/12
to quer...@googlegroups.com
Hi.

On Sunday, November 18, 2012 6:03:23 PM UTC+2, Asher Gruber wrote:
Hi,

I'm using the QueryDslPredicateExecutor findAll(Predicate predicate, Pageable pageable) method in Spring Data in order to support paging.
Creating a Predicate is very easy, but restricted (e.g. can not include joins). JPAQuery allows more complex queries, but will not allow me to use the findAll method.
Is it possible to convert JPAQuery to Predicate?

I don't think so. For more complex queries you need to create JPAQuery instances.

Br,
Timo
 

Thanks,
Asher.

Asher Gruber

unread,
Nov 19, 2012, 4:50:59 AM11/19/12
to quer...@googlegroups.com
Thanks. Is their a way to call a findAll method that accepts a JPAQuery and a Pagable parameters instead or should I implement this by my self.
I have many complex queries that need to support paging.

Thansk,
Asher.

Timo Westkämper

unread,
Nov 19, 2012, 4:54:43 AM11/19/12
to Querydsl on behalf of Asher Gruber
Hi.

On Mon, Nov 19, 2012 at 11:50 AM, Asher Gruber via Querydsl <querydsl+noreply-APn2wQdxnnigFq4...@googlegroups.com> wrote:
Thanks. Is their a way to call a findAll method that accepts a JPAQuery and a Pagable parameters instead or should I implement this by my self.
I have many complex queries that need to support paging.

You need to address the Spring Data guy with such a request. I'd put the JPAQuery handling inside the method implementation and not provide it as a parameter.

Br,
Timo
 

Thansk,
Asher.


On Monday, November 19, 2012 10:35:22 AM UTC+2, Timo Westkämper wrote:
Hi.

On Sunday, November 18, 2012 6:03:23 PM UTC+2, Asher Gruber wrote:
Hi,

I'm using the QueryDslPredicateExecutor findAll(Predicate predicate, Pageable pageable) method in Spring Data in order to support paging.
Creating a Predicate is very easy, but restricted (e.g. can not include joins). JPAQuery allows more complex queries, but will not allow me to use the findAll method.
Is it possible to convert JPAQuery to Predicate?

I don't think so. For more complex queries you need to create JPAQuery instances.

Br,
Timo
 

Thanks,
Asher.



--
Timo Westkämper
Mysema Oy
+358 (0)40 591 2172
www.mysema.com



Asher Gruber

unread,
Nov 19, 2012, 5:34:36 AM11/19/12
to quer...@googlegroups.com
OK. Thanks.


On Monday, November 19, 2012 11:54:45 AM UTC+2, Timo Westkämper wrote:
Hi.

Rishu Oberoi

unread,
Feb 28, 2017, 12:23:14 PM2/28/17
to Querydsl
Any solutions to this yet? It seems impossible to use predicate for a query that involves joins and have pagination for it
Reply all
Reply to author
Forward
0 new messages