`

hibernate的Restrictions

    博客分类:
  • java
阅读更多

 

方法

 

 

说明

 

 

Restrictions.eq

 

 

 

 

Restrictions.allEq

 

 

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

 

 

Restrictions.gt

 

 

 

 

Restrictions.ge

 

 

>=

 

 

Restrictions.lt

 

 

 

 

Restrictions.le

 

 

<=

 

 

Restrictions.between

 

 

闭区间xy中的任意值

 

 

Restrictions.like

 

 

字符串模式匹配,模糊查找

 

 

Restrictions.in

 

 

等于列表中的某一个值

 

 

Restrictions.and

 

 

逻辑与

 

 

Restrictions.or

 

逻辑或

 

 

Restrictions.sqlRestriction

 

 

用SQL限定查询

 

另:

HQL运算符 QBC运算符 含义
= Restrictions.eq() 等于
<> Restrictions.not(Exprission.eq()) 不等于
> Restrictions.gt() 大于
>= Restrictions.ge() 大于等于
< Restrictions.lt() 小于
<= Restrictions.le() 小于等于
is null Restrictions.isnull() 等于空值
is not null Restrictions.isNotNull() 非空值
like Restrictions.like() 字符串模式匹配
and Restrictions.and() 逻辑与
and Restrictions.conjunction() 逻辑与
or Restrictions.or() 逻辑或
or Restrictions.disjunction() 逻辑或
not Restrictions.not() 逻辑非
in(列表) Restrictions.in() 等于列表中的某一个值
ont in(列表) Restrictions.not(Restrictions.in())不等于列表中任意一个值
between x and y Restrictions.between() 闭区间xy中的任意值
not between x and y Restrictions.not(Restrictions..between()) 小于值X或者大于值y

分享到:
评论

相关推荐

    hibernate-shards.jar

    To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain ...

    hibernate ogm

    support simple JP-QL queries (restrictions and many-to-one joins) The medium target is: support other key/value stores support other NoSQL families support complex joins and aggregations The project...

    (3.0版本)自己写的struts2+hibernate+spring实例

    criteria.add(Restrictions.sqlRestriction("MENUITEM_ID in(select a.MENUITEM_ID from Wuxin_MENUITEM a connect by prior a.MENUITEM_ID = a.PARENT_ID"+ " start with a.MENUITEM_ID = '"+parentId+"')" )); ...

    Struts2 hibernate3 简单的学生查询

    Example em=Example.create(student).setPropertySelector(new EmptyStringSelector()); List list =session.createCriteria(Student.class).add... .add(Restrictions.between("birthday", date1, date2)) .list();

    用SSH+DWR+Oracle做的模拟Google搜索

    Hibernate的Criteria的条件添加 4、添加多个or //创建Criteria查询 Criteria c = super.getSession().createCriteria(Searchinfo.class); //构造函数 or Criterion ce = null ; for(String list:lists){ if...

    squirrel:一个基于JAVA的持久层包装。依赖于 Spring 的 JdbcTemplate 实现

    注:Hibernate 有冬眠之意,Squirrel ( 松鼠 ) 具有冬眠的习性,项目中众多类名称沿袭自 Hibernate,如 Criteria、Criterion、Restrictions 等。 Query private static Session session; @BeforeClass public static...

    ssh补充资料

    ssh补充资料,PPT,文档,练习等 Hibernate对象条件查询: 查询通过如下三个类获取:  Criteria 代表一次查询  Criterion 代表一个查询条件  Restrictions 产生查询条件的工具类

    jdbc基础和参考

    3.hibernate的配置文件(hibernate.cfg.xml)得存在 4.POJO.hbm.xml文件存在 5.hibernate的jar包以及数据库的驱动包存在 Hibernate的编程: 1.构建Configuration对象读取配置文件 2.读取映射文件 3.构建SessionFactory...

    spring-boot-reference.pdf

    I. Spring Boot Documentation 1. About the Documentation 2. Getting Help 3. First Steps 4. Working with Spring Boot 5. Learning about Spring Boot Features 6. Moving to Production 7. Advanced Topics ...

Global site tag (gtag.js) - Google Analytics