hibernate.Criteria分页排序模糊查询
org.hibernate.Criteria criteria = simpleDAO.getSession().createCriteria(Event.class); Criterion c = Restrictions.or(Restrictions.like("title", "%" + word + "%"), Restrictions.like("content", "%" + word + "%")); c = Restrictions.or(c, Restrictions.like("author", "%" + word + "%")); c = Restrictions.or(c, Restrictions.like("userName", "%" + word + "%")); c = Restrictions.or(c, Restrictions.like("place", "%" + word + "%")); c = Restrictions.or(c, Restrictions.like("people", "%" + word + "%")); c = Restrictions.or(c, Restrictions.like("source", "%" + word + "%")); criteria.add(c); criteria.addOrder(Order.asc("createTime")); criteria.setFirstResult(pageNo); criteria.setResultTransformer(org.hibernate.Criteria.DISTINCT_ROOT_ENTITY); criteria.setMaxResults(pageSize); List events = criteria.list();