return em.createQuery(criteria).getSingleResult();
}
public List<Member> findAllOrderedByName() {
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Member> criteria = cb.createQuery(Member.class);
Root<Member> member = criteria.from(Member.class);
// Swap criteria statements if you would like to try out type-safe criteria queries, a new
// feature in JPA 2.0
// criteria.select(member).orderBy(cb.asc(member.get(Member_.name)));
criteria.select(member).orderBy(cb.asc(member.get("name")));