JSF Component IDs

http://illegalargumentexception.blogspot.com/2009/02/jsf-working-with-component-ids.html

JPA2 Count(*) Criteria API

Example of using JPA2 Criterial Builder and Count(*) Function:

CriteriaBuilder cb = entityManager.getCriteriaBuilder();
CriteriaQuery<Long> cq = cb.createQuery(Long.class);
Root<Company> company = cq.from(Company.class);
Path<NaceCode> naceCodes = null;
naceCodes = company.join(Company_.topNaceCode);
Predicate naceCodeEqual = cb.equal(naceCodes, naceCode);
cq.where(naceCodeEqual);
Expression<Long> count = cb.count(company);
cq.select(count);
Long size = entityManager.createQuery(cq).getSingleResult();
return size.intValue();

More Examples: Google Books