Criteria criteria = session.createCriteria(User.class); criteria.add(Restrictions.eq("username", "john")); Listresults = criteria.list();
Criteria criteria = session.createCriteria(User.class); criteria.addOrder(Order.asc("username")); Listresults = criteria.list();
Criteria criteria = session.createCriteria(User.class); criteria.setMaxResults(10); ListThe org.hibernate.Session createCriteria method is a part of the Hibernate package library, which is used for working with databases in a Java environment.results = criteria.list();