[jpa-spec users] JPA_SPEC-44 - CriteriaQuery<T> where(List<Predicate> restrictions);

From: Yannick Majoros <>
Date: Wed, 13 Aug 2014 17:56:32 +0200


Some while ago, I opened this:

It was closed then. Could we reevaluate that?

My proposition was to add a List<Predicate> argument to
CriteriaQuery.where .

Quite often, I dynamically create a list of predicates, which I pass to
where() at the and. This now requires an array conversion.

Same for CrieriaBuilder.and() and CrieriaBuilder.or(), I suggest adding
a List<> parameter.

At least one person expressed some interest on the list (see below), but
didn't get an answer.

I think it is a minor improvement that could clean some code without
polluting the api. It will just make it consistent.

Is there a chance to get this in next JPA iteration? (when is it, btw?)


Yannick Majoros

From:*John D. Ament*<>
Date: 2013-01-23 18:00 GMT+01:00
Subject: [jpa-spec users] Re: criteria api missing where(List<Predicate>)


Atleast in my case, that assumes that you have one predicate already
defined. In my setup I have no predicates guaranteed defined. This
would end up happening:

Predicate p = null;

p = cb.and(p,cityPredicate)

Should that work?