Top Description Constructors Methods
org.hibernate.criterion

public Class Restrictions

extends Object
Class Inheritance
Known Direct Subclasses
org.hibernate.criterion.Expression
Imports
java.util.Collection, .Iterator, .Map, org.hibernate.type.Type, org.hibernate.util.ArrayHelper

The criterion 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
org.hibernate.Criteria, factory methods for <tt>Projection</tt> instances

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public static Criterion

Returns:

Criterion
allEq
(Map<K, V>
a map from property names to values
propertyNameValues
)

Apply an "equals" constraint to each property in the key set of a Map

public static LogicalExpression

Returns:

Criterion
and
(Criterion lhs, Criterion rhs)

Return the conjuction of two expressions

public static Criterion

Returns:

Criterion
between
(String propertyName, Object
value
lo
,
Object
value
hi
)

Apply a "between" constraint to the named property

public static Conjunction

Returns:

Conjunction
conjunction
()

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

public static Disjunction

Returns:

Conjunction
disjunction
()

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

public static SimpleExpression

Returns:

Criterion
eq
(String propertyName, Object value)

Apply an "equal" constraint to the named property

public static PropertyExpression
eqProperty(String propertyName, String otherPropertyName)

Apply an "equal" constraint to two properties

public static SimpleExpression

Returns:

Criterion
ge
(String propertyName, Object value)

Apply a "greater than or equal" constraint to the named property

public static PropertyExpression
geProperty(String propertyName, String otherPropertyName)

Apply a "greater than or equal" constraint to two properties

public static SimpleExpression

Returns:

Criterion
gt
(String propertyName, Object value)

Apply a "greater than" constraint to the named property

public static PropertyExpression
gtProperty(String propertyName, String otherPropertyName)

Apply a "greater than" constraint to two properties

public static Criterion

Returns:

Criterion
idEq
(Object value)

Apply an "equal" constraint to the identifier property

public static Criterion

Returns:

Criterion
ilike
(String propertyName, String value, MatchMode matchMode)

A case-insensitive "like", similar to Postgres ilike operator

public static Criterion

Returns:

Criterion
ilike
(String propertyName, Object value)

A case-insensitive "like", similar to Postgres ilike operator

public static Criterion

Returns:

Criterion
in
(String propertyName, Object[] values)

Apply an "in" constraint to the named property

public static Criterion

Returns:

Criterion
in
(String propertyName, Collection<E> values)

Apply an "in" constraint to the named property

public static Criterion
isEmpty(String propertyName)

Constrain a collection valued property to be empty

public static Criterion
isNotEmpty(String propertyName)

Constrain a collection valued property to be non-empty

public static Criterion

Returns:

Criterion
isNotNull
(String propertyName)

Apply an "is not null" constraint to the named property

public static Criterion

Returns:

Criterion
isNull
(String propertyName)

Apply an "is null" constraint to the named property

public static SimpleExpression

Returns:

Criterion
le
(String propertyName, Object value)

Apply a "less than or equal" constraint to the named property

public static PropertyExpression
leProperty(String propertyName, String otherPropertyName)

Apply a "less than or equal" constraint to two properties

public static SimpleExpression

Returns:

Criterion
like
(String propertyName, Object value)

Apply a "like" constraint to the named property

public static SimpleExpression

Returns:

Criterion
like
(String propertyName, String value, MatchMode matchMode)

Apply a "like" constraint to the named property

public static SimpleExpression

Returns:

Criterion
lt
(String propertyName, Object value)

Apply a "less than" constraint to the named property

public static PropertyExpression
ltProperty(String propertyName, String otherPropertyName)

Apply a "less than" constraint to two properties

public static NaturalIdentifier
public static SimpleExpression

Returns:

Criterion
ne
(String propertyName, Object value)

Apply a "not equal" constraint to the named property

public static PropertyExpression
neProperty(String propertyName, String otherPropertyName)

Apply a "not equal" constraint to two properties

public static Criterion

Returns:

Criterion
not
(Criterion expression)

Return the negation of an expression

public static LogicalExpression

Returns:

Criterion
or
(Criterion lhs, Criterion rhs)

Return the disjuction of two expressions

public static Criterion
sizeEq(String propertyName, int size)

Constrain a collection valued property by size

public static Criterion
sizeGe(String propertyName, int size)

Constrain a collection valued property by size

public static Criterion
sizeGt(String propertyName, int size)

Constrain a collection valued property by size

public static Criterion
sizeLe(String propertyName, int size)

Constrain a collection valued property by size

public static Criterion
sizeLt(String propertyName, int size)

Constrain a collection valued property by size

public static Criterion
sizeNe(String propertyName, int size)

Constrain a collection valued property by size

public static Criterion

Returns:

Criterion
sqlRestriction
(String sql, Object[] values, Type[] types)

Apply a constraint expressed in SQL, with the given JDBC parameters.

public static Criterion

Returns:

Criterion
sqlRestriction
(String sql, Object value, Type type)

Apply a constraint expressed in SQL, with the given JDBC parameter.

public static Criterion

Returns:

Criterion
sqlRestriction
(String sql)

Apply a constraint expressed in SQL.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Restrictionsback to summary
pack-priv Restrictions()

Method Detail

allEqback to summary
public static Criterion allEq(Map<K, V> propertyNameValues)

Apply an "equals" constraint to each property in the key set of a Map

Parameters
propertyNameValues:Map<K, V>

a map from property names to values

Returns:Criterion

Criterion

andback to summary
public static LogicalExpression and(Criterion lhs, Criterion rhs)

Return the conjuction of two expressions

Returns:LogicalExpression

Criterion

betweenback to summary
public static Criterion between(String propertyName, Object lo, Object hi)

Apply a "between" constraint to the named property

Parameters
lo:Object

value

hi:Object

value

Returns:Criterion

Criterion

conjunctionback to summary
public static Conjunction conjunction()

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

Returns:Conjunction

Conjunction

disjunctionback to summary
public static Disjunction disjunction()

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

Returns:Disjunction

Conjunction

eqback to summary
public static SimpleExpression eq(String propertyName, Object value)

Apply an "equal" constraint to the named property

Returns:SimpleExpression

Criterion

eqPropertyback to summary
public static PropertyExpression eqProperty(String propertyName, String otherPropertyName)

Apply an "equal" constraint to two properties

geback to summary
public static SimpleExpression ge(String propertyName, Object value)

Apply a "greater than or equal" constraint to the named property

Returns:SimpleExpression

Criterion

gePropertyback to summary
public static PropertyExpression geProperty(String propertyName, String otherPropertyName)

Apply a "greater than or equal" constraint to two properties

gtback to summary
public static SimpleExpression gt(String propertyName, Object value)

Apply a "greater than" constraint to the named property

Returns:SimpleExpression

Criterion

gtPropertyback to summary
public static PropertyExpression gtProperty(String propertyName, String otherPropertyName)

Apply a "greater than" constraint to two properties

idEqback to summary
public static Criterion idEq(Object value)

Apply an "equal" constraint to the identifier property

Returns:Criterion

Criterion

ilikeback to summary
public static Criterion ilike(String propertyName, String value, MatchMode matchMode)

A case-insensitive "like", similar to Postgres ilike operator

Returns:Criterion

Criterion

ilikeback to summary
public static Criterion ilike(String propertyName, Object value)

A case-insensitive "like", similar to Postgres ilike operator

Returns:Criterion

Criterion

inback to summary
public static Criterion in(String propertyName, Object[] values)

Apply an "in" constraint to the named property

Returns:Criterion

Criterion

inback to summary
public static Criterion in(String propertyName, Collection<E> values)

Apply an "in" constraint to the named property

Returns:Criterion

Criterion

isEmptyback to summary
public static Criterion isEmpty(String propertyName)

Constrain a collection valued property to be empty

isNotEmptyback to summary
public static Criterion isNotEmpty(String propertyName)

Constrain a collection valued property to be non-empty

isNotNullback to summary
public static Criterion isNotNull(String propertyName)

Apply an "is not null" constraint to the named property

Returns:Criterion

Criterion

isNullback to summary
public static Criterion isNull(String propertyName)

Apply an "is null" constraint to the named property

Returns:Criterion

Criterion

leback to summary
public static SimpleExpression le(String propertyName, Object value)

Apply a "less than or equal" constraint to the named property

Returns:SimpleExpression

Criterion

lePropertyback to summary
public static PropertyExpression leProperty(String propertyName, String otherPropertyName)

Apply a "less than or equal" constraint to two properties

likeback to summary
public static SimpleExpression like(String propertyName, Object value)

Apply a "like" constraint to the named property

Returns:SimpleExpression

Criterion

likeback to summary
public static SimpleExpression like(String propertyName, String value, MatchMode matchMode)

Apply a "like" constraint to the named property

Returns:SimpleExpression

Criterion

ltback to summary
public static SimpleExpression lt(String propertyName, Object value)

Apply a "less than" constraint to the named property

Returns:SimpleExpression

Criterion

ltPropertyback to summary
public static PropertyExpression ltProperty(String propertyName, String otherPropertyName)

Apply a "less than" constraint to two properties

naturalIdback to summary
public static NaturalIdentifier naturalId()
neback to summary
public static SimpleExpression ne(String propertyName, Object value)

Apply a "not equal" constraint to the named property

Returns:SimpleExpression

Criterion

nePropertyback to summary
public static PropertyExpression neProperty(String propertyName, String otherPropertyName)

Apply a "not equal" constraint to two properties

notback to summary
public static Criterion not(Criterion expression)

Return the negation of an expression

Returns:Criterion

Criterion

orback to summary
public static LogicalExpression or(Criterion lhs, Criterion rhs)

Return the disjuction of two expressions

Returns:LogicalExpression

Criterion

sizeEqback to summary
public static Criterion sizeEq(String propertyName, int size)

Constrain a collection valued property by size

sizeGeback to summary
public static Criterion sizeGe(String propertyName, int size)

Constrain a collection valued property by size

sizeGtback to summary
public static Criterion sizeGt(String propertyName, int size)

Constrain a collection valued property by size

sizeLeback to summary
public static Criterion sizeLe(String propertyName, int size)

Constrain a collection valued property by size

sizeLtback to summary
public static Criterion sizeLt(String propertyName, int size)

Constrain a collection valued property by size

sizeNeback to summary
public static Criterion sizeNe(String propertyName, int size)

Constrain a collection valued property by size

sqlRestrictionback to summary
public static Criterion sqlRestriction(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.

Returns:Criterion

Criterion

sqlRestrictionback to summary
public static Criterion sqlRestriction(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.

Returns:Criterion

Criterion

sqlRestrictionback to summary
public static Criterion sqlRestriction(String sql)

Apply a constraint expressed in SQL. Any occurrences of {alias} will be replaced by the table alias.

Returns:Criterion

Criterion