站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Hibernate 2.1.8 正式版 API 英文文档

Expression (Hibernate API Documentation) - Hibernate 2.1.8 正式版 API 英文文档


net.sf.hibernate.expression
Class Expression

java.lang.Object
  extended bynet.sf.hibernate.expression.Expression

public final class Expression
extends Object

The expression package may be used by applications as a framework for building new kinds of Criterion. However, it is intended that most applications will simply use the built-in criterion types via the static factory methods of this class.

Author:
Gavin King
See Also:
Criteria

Method Summary
static Criterion allEq(Map propertyNameValues)
          Apply an "equals" constraint to each property in the key set of a Map
static Criterion and(Criterion lhs, Criterion rhs)
          Return the conjuction of two expressions
static Criterion between(String propertyName, Object lo, Object hi)
          Apply a "between" constraint to the named property
static Conjunction conjunction()
          Group expressions together in a single conjunction (A and B and C...)
static Disjunction disjunction()
          Group expressions together in a single disjunction (A or B or C...)
static SimpleExpression eq(String propertyName, Object value)
          Apply an "equal" constraint to the named property
static Criterion eqProperty(String propertyName, String otherPropertyName)
          Apply an "equal" constraint to two properties
static SimpleExpression ge(String propertyName, Object value)
          Apply a "greater than or equal" constraint to the named property
static SimpleExpression gt(String propertyName, Object value)
          Apply a "greater than" constraint to the named property
static Criterion ilike(String propertyName, Object value)
          A case-insensitive "like", similar to Postgres ilike operator
static Criterion ilike(String propertyName, String value, MatchMode matchMode)
          A case-insensitive "like", similar to Postgres ilike operator
static Criterion in(String propertyName, Collection values)
          Apply an "in" constraint to the named property
static Criterion in(String propertyName, Object[] values)
          Apply an "in" constraint to the named property
static Criterion isNotNull(String propertyName)
          Apply an "is not null" constraint to the named property
static Criterion isNull(String propertyName)
          Apply an "is null" constraint to the named property
static SimpleExpression le(String propertyName, Object value)
          Apply a "less than or equal" constraint to the named property
static Criterion leProperty(String propertyName, String otherPropertyName)
          Apply a "less than or equal" constraint to two properties
static SimpleExpression like(String propertyName, Object value)
          Apply a "like" constraint to the named property
static SimpleExpression like(String propertyName, String value, MatchMode matchMode)
          Apply a "like" constraint to the named property
static SimpleExpression lt(String propertyName, Object value)
          Apply a "less than" constraint to the named property
static Criterion ltProperty(String propertyName, String otherPropertyName)
          Apply a "less than" constraint to two properties
static Criterion not(Criterion expression)
          Return the negation of an expression
static Criterion or(Criterion lhs, Criterion rhs)
          Return the disjuction of two expressions
static Criterion sql(String sql)
          Apply a constraint expressed in SQL.
static Criterion sql(String sql, Object[] values, Type[] types)
          Apply a constraint expressed in SQL, with the given JDBC parameters.
static Criterion sql(String sql, Object value, Type type)
          Apply a constraint expressed in SQL, with the given JDBC parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

eq

public static SimpleExpression eq(String propertyName,
                                  Object value)
Apply an "equal" constraint to the named property

Parameters:
propertyName -
value -
Returns:
Criterion

like

public static SimpleExpression like(String propertyName,
                                    Object value)
Apply a "like" constraint to the named property

Parameters:
propertyName -
value -
Returns:
Criterion

like

public static SimpleExpression like(String propertyName,
                                    String value,
                                    MatchMode matchMode)
Apply a "like" constraint to the named property

Parameters:
propertyName -
value -
Returns:
Criterion

ilike

public static Criterion ilike(String propertyName,
                              String value,
                              MatchMode matchMode)
A case-insensitive "like", similar to Postgres ilike operator

Parameters:
propertyName -
value -
Returns:
Criterion

ilike

public static Criterion ilike(String propertyName,
                              Object value)
A case-insensitive "like", similar to Postgres ilike operator

Parameters:
propertyName -
value -
Returns:
Criterion

gt

public static SimpleExpression gt(String propertyName,
                                  Object value)
Apply a "greater than" constraint to the named property

Parameters:
propertyName -
value -
Returns:
Criterion

lt

public static SimpleExpression lt(String propertyName,
                                  Object value)
Apply a "less than" constraint to the named property

Parameters:
propertyName -
value -
Returns:
Criterion

le

public static SimpleExpression le(String propertyName,
                                  Object value)
Apply a "less than or equal" constraint to the named property

Parameters:
propertyName -
value -
Returns:
Criterion

ge

public static SimpleExpression ge(String propertyName,
                                  Object value)
Apply a "greater than or equal" constraint to the named property

Parameters:
propertyName -
value -
Returns:
Criterion

between

public static Criterion between(String propertyName,
                                Object lo,
                                Object hi)
Apply a "between" constraint to the named property

Parameters:
propertyName -
lo - value
hi - value
Returns:
Criterion

in

public static Criterion in(String propertyName,
                           Object[] values)
Apply an "in" constraint to the named property

Parameters:
propertyName -
values -
Returns:
Criterion

in

public static Criterion in(String propertyName,
                           Collection values)
Apply an "in" constraint to the named property

Parameters:
propertyName -
values -
Returns:
Criterion

isNull

public static Criterion isNull(String propertyName)
Apply an "is null" constraint to the named property

Returns:
Criterion

eqProperty

public static Criterion eqProperty(String propertyName,
                                   String otherPropertyName)
Apply an "equal" constraint to two properties


ltProperty

public static Criterion ltProperty(String propertyName,
                                   String otherPropertyName)
Apply a "less than" constraint to two properties


leProperty

public static Criterion leProperty(String propertyName,
                                   String otherPropertyName)
Apply a "less than or equal" constraint to two properties


isNotNull

public static Criterion isNotNull(String propertyName)
Apply an "is not null" constraint to the named property

Returns:
Criterion

and

public static Criterion and(Criterion lhs,
                            Criterion rhs)
Return the conjuction of two expressions

Parameters:
lhs -
rhs -
Returns:
Criterion

or

public static Criterion or(Criterion lhs,
                           Criterion rhs)
Return the disjuction of two expressions

Parameters:
lhs -
rhs -
Returns:
Criterion

not

public static Criterion not(Criterion expression)
Return the negation of an expression

Parameters:
expression -
Returns:
Criterion

sql

public static Criterion sql(String sql,
                            Object[] values,
                            Type[] types)
Apply a constraint expressed in SQL, with the given JDBC parameters. Any occurrences of {alias} will be replaced by the table alias.

Parameters:
sql -
values -
types -
Returns:
Criterion

sql

public static Criterion sql(String sql,
                            Object value,
                            Type type)
Apply a constraint expressed in SQL, with the given JDBC parameter. Any occurrences of {alias} will be replaced by the table alias.

Parameters:
sql -
value -
type -
Returns:
Criterion

sql

public static Criterion sql(String sql)
Apply a constraint expressed in SQL. Any occurrences of {alias} will be replaced by the table alias.

Parameters:
sql -
Returns:
Criterion

conjunction

public static Conjunction conjunction()
Group expressions together in a single conjunction (A and B and C...)

Returns:
Conjunction

disjunction

public static Disjunction disjunction()
Group expressions together in a single disjunction (A or B or C...)

Returns:
Conjunction

allEq

public static Criterion allEq(Map propertyNameValues)
Apply an "equals" constraint to each property in the key set of a Map

Parameters:
propertyNameValues - a map from property names to values
Returns:
Criterion