I have this Java code:
CriteriaBuilder qb = entityManager.getCriteriaBuilder();
CriteriaQuery<Long> cq = qb.createQuery(Long.class);
cq.select(qb.count(cq.from(MyEntity.class)));
cq.where(/*your stuff*/);
return entityManager.createQuery(cq).getSingleResult();
I would like to do this a criteria query:
SELECT COUNT(p),pa.nomPays FROM SessionPersonne s JOIN s.personne p ,
p.entreprise e , e.adresse a , a.localite l , l.pays pa , s.session session
WHERE size(s.passageCollection) > 0 GROUP BY pa.nomPays
but how do size(s.passageCollection) > 0
with the critical query ?
Thanks you.