hibernate Restrictions用法
方法 |
說明 |
Restrictions.eq |
= |
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限定查詢 |
QBC常用限定方法
Restrictions.eq --> equal,等于.
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'"
posted on 2010-09-23 16:50 游雯 閱讀(795) 評論(0) 編輯 收藏 所屬分類: Java技術