我想为此查询创建等效的CriteriaQuery: 从用户u中选择u,其中u.name =“John”,u.surname =“Black”,u.middlename =“Small”; 但我对“where”谓词有疑问。 感谢
答案 0 :(得分:0)
您可以使用:
CriteriaBuilder builder = entityManager.getCriteriaBuilder();
CriteriaQuery c = ...;
Root root = ...;
Predications name = builder.equal(root.get("name"), name);
Predications surname = ...;
Predications middlename = ...;
c.where(name, surname, middlename);