zoukankan      html  css  js  c++  java
  • Criteria

    http://blog.csdn.net/qq_16313365/article/details/4204448

    http://blog.sina.com.cn/s/blog_e2c74e2a0101t9nb.html

    Restrictions用法:

    1. 方法说明

    方法

    说明

    Restrictions.eq

    Restrictions.ne

    Restrictions.allEq

    <>

    利用Map来进行多个等于的限制

    Restrictions.gt

    Restrictions.ge

    >=

    Restrictions.lt

    Restrictions.le

    <=

    Restrictions.between

    BETWEEN

    Restrictions.like

    LIKE

    Restrictions.in

    in

    Restrictions.and

    and

    Restrictions.or

    or

    Restrictions.sqlRestriction

    用SQL限定查询

    2,QBC常用限定方法

    Restrictions.eq --> equal,等于.

    Restrictions.ne --> not-equals,不等于

    Restrictions.allEq --> 参数为Map对象,使用key/value进行多个等于的比对,相当于多个Restrictions.eq的效果

    Restrictions.gt --> great-than > 大于

    Restrictions.ge --> great-equal >= 大于等于

    Restrictions.lt --> less-than, < 小于

    Restrictions.le --> less-equal <= 小于等于

    Restrictions.between --> 对应SQL的between子句

    Restrictions.like --> 对应SQL的LIKE子句

    Restrictions.in --> 对应SQL的in子句

    Restrictions.and --> and 关系

    Restrictions.or --> or 关系

    Restrictions.isNull --> 判断属性是否为空,为空则返回true

    Restrictions.isNotNull --> 与isNull相反

    Restrictions.sqlRestriction --> SQL限定的查询

    Order.asc --> 根据传入的字段进行升序排序

    Order.desc --> 根据传入的字段进行降序排序

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

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

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

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

    setReadOnly()

    给特定的持久化对象禁用脏查询的一种方法 是设置session.setReadOnly(object,true)。你可以告诉Hibernate:由查询返回的所有实体对象都应该被当作是只读的,由这个查询返回的所有Item对象都处于持久化状态,但是在持久化上下文中,没有给自动脏检查启用任何快照。hibernate不会自动持久化任何修改,除非用session.setReadOnly(object,false)禁用只模式。

  • 相关阅读:
    学习Python第三天
    学习Python第二天
    学习Python第一天
    centos7 系统优化
    crond计划任务
    day2
    day1
    A.浏览器访问 kube-apiserver 安全端口
    12.清理集群
    11.部署 harbor 私有仓库
  • 原文地址:https://www.cnblogs.com/sam-cheng/p/8340293.html
Copyright © 2011-2022 走看看