Criteria queries allow for multiple root level objects. Caution should be used when doing this, as it can result in Cartesian products of the two table. The where clause should ensure the two objects are joined in some way.
// Select the employees and the mailing addresses that have the same address.
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery criteriaQuery = criteriaBuilder.createQuery();
Root employee = criteriaQuery.from(Employee.class);
Root address = criteriaQuery.from(MailingAddress.class);
Query query = entityManager.createQuery(criteriaQuery);
List<Object> result = query.getResultList();
M. Thein, and M. Thwin. International Journal of Computer Science, Engineering and Information Technology (IJCSEIT)
, volume 2 of IFIP Advances in Information and Communication Technology, page 13-32. Springer, (December 2012)