hibernateTemplate 模糊分页查询
来源:互联网 发布:2015年淘宝的销售额 编辑:程序博客网 时间:2024/04/29 17:46
Restrictions.like(),Restrictions.in(),Restrictions.eq()等方法
Restrictions.like(属性名, 查询条件的值,匹配方式):
Restrictions.in(属性名, 查询条件的值,匹配方式):
Restrictions.eq(属性名, 查询条件的值,匹配方式):
Criteria Query常用的查询限制方法
Restrictions.eq() equal,=
Restrictions.allEq()参数为Map对象,使用key/value进行多个等于的对比,相当于多个Restrictions.eq()的效果
Restrictions.gt() greater-than, >
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,否则返回false
Restrictions.isNotNull() 与Restrictions.isNull()相反
Order.asc() 根据传入的字段进行升序排序
Order.desc() 根据传入的字段进行降序排序
MatchMode.EXACT 字符串精确匹配,相当于“like 'value'”
MatchMode.ANYWHERE 字符串在中间位置,相当于“like '%value%'”
MatchMode.START 字符串在最前面的位置,相当于“like 'value%'”
MatchMode.END 字符串在最后面的位置,相当于“like '%value'”
public
}
-------------------------------------------------------------------------------------
例1:
表中的数据为:
userid name username password age
------------------------------------------------
Session session = HibernateSessionFactory.getSession();
Criteria criteria = session.createCriteria(Test.class);
List<Test> list =criteria.add(Restrictions.like("name", "%your%"))
.add(Restrictions.like("username", "test"))
.add(Restrictions.eq("age", 30))
.list();
------------------------------------------------------------------------------------
例2:
private Session session;
public List criteria(SalChance salChance) {- hibernateTemplate 模糊分页查询
- [Hibernate]hibernateTemplate模糊查询
- 关于hibernateTemplate的模糊查询
- 使用 HibernateTemplate 实现分页查询
- 使用 HibernateTemplate 实现分页查询
- 使用 HibernateTemplate 实现分页查询
- MyBatis模糊查询分页
- 模糊查询+分页
- ssh分页+模糊查询
- 分页 模糊查询
- 扩展HibernateTemplate,实现分页查询 (回调)
- 使用 HibernateTemplate 实现分页查询 (HibernateCallback接口)
- Hibernate HQL查询 分页查询 模糊查询
- Hibernate HQL查询 分页查询 模糊查询
- Hibernate HQL查询 分页查询 模糊查询 .
- ASP模糊查询分页问题
- Access 模糊 参数 查询 分页
- 分页模糊查询存储过程
- 跟踪 twisted 里deferred 的Callback
- MathType 6.0 中某些符号不能正确显示
- Linux常用命令大全
- shell经典面试题
- 排序
- hibernateTemplate 模糊分页查询
- Python匹配相同首字母的名字对
- php读取文本文件内容
- leetcode: Search Insert Position
- 编程之美:一摞烙饼的排序
- BoW(SIFT/SURF/...)+SVM/KNN的OpenCV 实现
- 鼠标经过图片变暗,css
- 【Android UI设计与开发】第18期:滑动菜单栏(三)SlidingMenu动画效果的实现
- Ubuntu 64位跑32位程序