Expression查询语法

A:Expression查询语法
1:Expression.eq: 对应sql(fidld=value):Expression.eq("name","zhengjigang")
2:Expression.allEq:参数为一个Map对象。相当于多个Expression.eq关系的叠加
3:Expression.gt:对应sql(field>value)
4:Expression.ge:对应sql(field>=value)
5:Expression.lt:对应sql(field<value)
6:Expression.le:对应sql(field<=value)
7:Expression.between:对应sql中的between表达式:Expression.between("age",new Integer(13),new Integer(15))
8:Expression.like:对应sql(field like value)
9:Expression.in:对应sql(field in value)
10:Expression.eqProperty:对应pojo属性的sql(field=field):Expression.eqProperty("Tuser.groupId","Tgroup.id")
11:Expression.gtProperty:对应的sql(field>field)
12:Expression.geProperty:对应的sql(field>=field)
13:Expression.ltProperty:对应的sql(field<field)
14:Expression.leProperty:对应的sql(field<=field)
15:Expression.and:and关系组合:Expression.and(Expression.eq("name","zhengjigang"),Expression.eq("job","软件工程师"))
16:Expression.or:and关系组合:Expression.or(Expression.eq("name","zhengjigang"),Expression.eq("job","软件工程师"))
17:Expression.sql:提供原生sql语法的支持:Expression.sql("lower({demo}.name) like lower(?)","zhengjigang%",Hibernate.String)

B:Criteria的高级查询
1: 限定返回的记录条数:Criteria criteria=session.createCriteria(Tuser.class);
         criteria.

posted @ 2011-09-29 14:51  十年如一  阅读(1269)  评论(1编辑  收藏  举报