use of org.eclipse.persistence.jpa.JpaCriteriaBuilder in project eclipselink by eclipse-ee4j.
the class AdvancedCriteriaQueryTestSuite method testFromToExpression.
public void testFromToExpression() {
EntityManager em = createEntityManager();
beginTransaction(em);
try {
JpaCriteriaBuilder cb = (JpaCriteriaBuilder) em.getCriteriaBuilder();
CriteriaQuery<Employee> cquery = cb.createQuery(Employee.class);
Root<Employee> emp = cquery.from(Employee.class);
cquery.where(cb.fromExpression(cb.toExpression(emp).get("id").notNull()));
TypedQuery<Employee> tquery = em.createQuery(cquery);
List<Employee> result = tquery.getResultList();
result.size();
} finally {
rollbackTransaction(em);
closeEntityManager(em);
}
}
Aggregations