Hibernate 5 - createCriteria deprecated
问题 I need a help to migrate the code with createCriteria for Hibernate 5 , the code is this below: public Curso comDadosIguais(Curso curso) { return (Curso) this.session.createCriteria(Curso.class) .add(Restrictions.eq("codigo", curso.getCodigo())) .uniqueResult(); } Could you help me? 回答1: There are a number of options you can exercise to migrate from the deprecated Hibernate Criteria API, these are just a few that immediately come to mind: HQL / JPQL Named query JPA Criteria API From a HQL /