Hello,
Some while ago, I opened this:
https://java.net/jira/browse/JPA_SPEC-44
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?)
Thanks,
Yannick Majoros
From:*John D. Ament*<john.d.ament_at_gmail.com>
Date: 2013-01-23 18:00 GMT+01:00
Subject: [jpa-spec users] Re: criteria api missing where(List<Predicate>)
To: users_at_jpa-spec.java.net
Linda,
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?