Hibernate 5 CriteriaBuilder query by id

330 Views Asked by At

Since Hibernate 5 no longer supports createCriteria, I cannot figure out how to replace the old session.createCriteria(className.class).add(Restrictions.idEq(id)).list(); idEq() part with CriteriaBuilder. CriteriaBuilder equal method works only if I have attribute name. What I need is query by identifier.

Any ideas?

0

There are 0 best solutions below