Instead of that, you need this code:
criteriaQuery.where(criteriaBuilder.and(
criteriaBuilder.equal(subscriptionRoot.get("user"), user),
criteriaBuilder.equal(subscriptionRoot.get("plan"), plan)));
CriteriaQuery.and
takes several parameters, each Predicate
s that should be and
ed together.