Criteria c=session.createCriteria(Customer.class);
?//设置条件
?c.add(Expression.ge(“字段名”,”值对象”))
ge:>=
gt:>
le:<=
lt:<
eq:=
?//排序
c.addOrder(Order.asc(“字段名”))
?//分页
c.setFirstResult(1)//从第2行开始提取
c.setMaxResults(5)//返回5行
?DetachedCriteria产生时不需要session
?DetachedCriteria dc= DetachedCriteria.forClass(Customer.class)
?Criteria c=Dc.getExecutableCriteria(session) |