CriteriaBuilder cb = entityManager.getCriteriaBuilder();
CriteriaQuery<Energy> cq = cb.createQuery(Energy.class);
Root<Energy> root = cq.from(Energy.class);
Join<Energy,Value> join = root.join(Energy_.values);
//If you dont use metamodel change by root.join("values")
cq.select(root);
cq.where(cb.equal(join.get(Value_.value),VALUE));
//If you dont use metamodel change by join.get("value")
List<Energy> result = entityManager.createQuery(cq).getResultList();
1条答案
按热度按时间uujelgoq1#
这取决于您选择的实现,例如使用标准api: