Hibernate 查询 Restrictions 类使用

实例参考地址:

http://blog.163.com/zhaowenchao_vip/blog/static/1715151442012411101741608/

(1)比较运算符( propertyName 是指Java对象的属性名称而不是数据库表对象的列名 

HQL运算符 QBC运算符 含义

           1.= Restrictions.eq(String propertyName,Object value) 等于 

                        

           2.<> Restrictions.not(Exprission.eq()) 不等于

           3.> Restrictions.gt() 大于

           4.>= Restrictions.ge() 大于等于

           5.< Restrictions.lt() 小于

           6.<= Restrictions.le() 小于等于

           7.is null Restrictions.isnull() 等于空值

           8.is not null Restrictions.isNotNull() 非空值

           9.like Restrictions.like() 字符串模式匹配

                    MatchMode.EXACT --> 字符串精确匹配.相当于"like 'value'"

                    MatchMode.ANYWHERE --> 字符串在中间匹配.相当于"like '%value%'"

                    MatchMode.START --> 字符串在最前面的位置.相当于"like 'value%'"

 

                    MatchMode.END --> 字符串在最后面的位置.相当于"like '%value'"

                   A:Restrictions.like('Entity property','real value',MatchMode.START

          10.and Restrictions.and() 逻辑与

          11.and Restrictions.conjunction() 逻辑与

          12.or Restrictions.or() 逻辑或

          13.or Restrictions.disjunction() 逻辑或

          14.not Restrictions.not() 逻辑非

          15.in(列表) Restrictions.in() 等于列表中的某一个值

          16.ont in(列表) Restrictions.not(Restrictions.in())不等于列表中任意一个值

          17.between x and y Restrictions.between() 闭区间xy中的任意值

          18.not between x and y Restrictions.not(Restrictions..between()) 小于值X或者大于值y

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值