org.hibernate.criterion.Example use with CriteriaQuery
问题 I have following code that I need to refactor for use in hibernate 5. This includes removing every deprecated call. public List<T> findByExample(T example, String... excludeProperty) { Criteria crit = session.createCriteria(T.class); Example ex = Example.create(example); for (String exclude : excludeProperty) { ex.excludeProperty(exclude); } crit.add(ex); return crit.list(); } Since createCriteria is deprecated I was going to replace it with getSession().getCriteriaBuilder().createQuery(Foo