// Get results using custom class
CriteriaQuery<OrderProducer> constructQuery = qb.createQuery(OrderProducer.class);
Root<Order> order2 = constructQuery.from(Order.class);
Join<Item, Producer> producer2 = order.join(Order_.items).join(Item_.producer);
constructQuery.select(qb.construct(OrderProducer.class, order2, producer2));
constructQuery.where(qb.equal(order2.get(Order_.filled), Boolean.TRUE));
TypedQuery<OrderProducer> typedQuery = em.createQuery(constructQuery);
List<OrderProducer> constructResults = typedQuery.getResultList();
assertEquals(N_ORDERS / 2 * N_ITEMS_PER_ORDER, jpqlResults.size());
assertEquals(N_ORDERS / 2 * N_ITEMS_PER_ORDER, criteriaResults.size());