public class Restrictions
extends java.lang.Object
Projections
factory methods for generating Projection
instancesCriteria
Modifier | Constructor and Description |
---|---|
protected |
Restrictions() |
Modifier and Type | Method and Description |
---|---|
static Criterion |
allEq(java.util.Map<java.lang.String,?> propertyNameValues)
Apply an "equals" constraint to each property in the key set of a Map
|
static Conjunction |
and(Criterion... predicates)
Return the conjuction of multiple expressions
|
static LogicalExpression |
and(Criterion lhs,
Criterion rhs)
Return the conjuction of two expressions
|
static Criterion |
between(java.lang.String propertyName,
java.lang.Object low,
java.lang.Object high)
Apply a "between" constraint to the named property
|
static Conjunction |
conjunction()
Group expressions together in a single conjunction (A and B and C...).
|
static Conjunction |
conjunction(Criterion... conditions)
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 Disjunction |
disjunction(Criterion... conditions)
Group expressions together in a single disjunction (A or B or C...).
|
static SimpleExpression |
eq(java.lang.String propertyName,
java.lang.Object value)
Apply an "equal" constraint to the named property
|
static Criterion |
eqOrIsNull(java.lang.String propertyName,
java.lang.Object value)
Apply an "equal" constraint to the named property.
|
static PropertyExpression |
eqProperty(java.lang.String propertyName,
java.lang.String otherPropertyName)
Apply an "equal" constraint to two properties
|
static SimpleExpression |
ge(java.lang.String propertyName,
java.lang.Object value)
Apply a "greater than or equal" constraint to the named property
|
static PropertyExpression |
geProperty(java.lang.String propertyName,
java.lang.String otherPropertyName)
Apply a "greater than or equal" constraint to two properties
|
static SimpleExpression |
gt(java.lang.String propertyName,
java.lang.Object value)
Apply a "greater than" constraint to the named property
|
static PropertyExpression |
gtProperty(java.lang.String propertyName,
java.lang.String otherPropertyName)
Apply a "greater than" constraint to two properties
|
static Criterion |
idEq(java.lang.Object value)
Apply an "equal" constraint to the identifier property
|
static Criterion |
ilike(java.lang.String propertyName,
java.lang.Object value)
A case-insensitive "like" (similar to Postgres ilike operator)
|
static Criterion |
ilike(java.lang.String propertyName,
java.lang.String value,
MatchMode matchMode)
A case-insensitive "like" (similar to Postgres ilike operator) using the provided match mode
|
static Criterion |
in(java.lang.String propertyName,
java.util.Collection values)
Apply an "in" constraint to the named property.
|
static Criterion |
in(java.lang.String propertyName,
java.lang.Object... values)
Apply an "in" constraint to the named property.
|
static Criterion |
isEmpty(java.lang.String propertyName)
Constrain a collection valued property to be empty
|
static Criterion |
isNotEmpty(java.lang.String propertyName)
Constrain a collection valued property to be non-empty
|
static Criterion |
isNotNull(java.lang.String propertyName)
Apply an "is not null" constraint to the named property
|
static Criterion |
isNull(java.lang.String propertyName)
Apply an "is null" constraint to the named property
|
static SimpleExpression |
le(java.lang.String propertyName,
java.lang.Object value)
Apply a "less than or equal" constraint to the named property
|
static PropertyExpression |
leProperty(java.lang.String propertyName,
java.lang.String otherPropertyName)
Apply a "less than or equal" constraint to two properties
|
static SimpleExpression |
like(java.lang.String propertyName,
java.lang.Object value)
Apply a "like" constraint to the named property
|
static SimpleExpression |
like(java.lang.String propertyName,
java.lang.String value,
MatchMode matchMode)
Apply a "like" constraint to the named property using the provided match mode
|
static SimpleExpression |
lt(java.lang.String propertyName,
java.lang.Object value)
Apply a "less than" constraint to the named property
|
static PropertyExpression |
ltProperty(java.lang.String propertyName,
java.lang.String otherPropertyName)
Apply a "less than" constraint to two properties
|
static NaturalIdentifier |
naturalId()
Consider using any of the natural id based loading stuff from session instead, especially in cases
where the restriction is the full set of natural id values.
|
static SimpleExpression |
ne(java.lang.String propertyName,
java.lang.Object value)
Apply a "not equal" constraint to the named property
|
static Criterion |
neOrIsNotNull(java.lang.String propertyName,
java.lang.Object value)
Apply a "not equal" constraint to the named property.
|
static PropertyExpression |
neProperty(java.lang.String propertyName,
java.lang.String otherPropertyName)
Apply a "not equal" constraint to two properties
|
static Criterion |
not(Criterion expression)
Return the negation of an expression
|
static Disjunction |
or(Criterion... predicates)
Return the disjuction of multiple expressions
|
static LogicalExpression |
or(Criterion lhs,
Criterion rhs)
Return the disjuction of two expressions
|
static Criterion |
sizeEq(java.lang.String propertyName,
int size)
Constrain a collection valued property by size
|
static Criterion |
sizeGe(java.lang.String propertyName,
int size)
Constrain a collection valued property by size
|
static Criterion |
sizeGt(java.lang.String propertyName,
int size)
Constrain a collection valued property by size
|
static Criterion |
sizeLe(java.lang.String propertyName,
int size)
Constrain a collection valued property by size
|
static Criterion |
sizeLt(java.lang.String propertyName,
int size)
Constrain a collection valued property by size
|
static Criterion |
sizeNe(java.lang.String propertyName,
int size)
Constrain a collection valued property by size
|
static Criterion |
sqlRestriction(java.lang.String sql)
Apply a constraint expressed in SQL with no JDBC parameters.
|
static Criterion |
sqlRestriction(java.lang.String sql,
java.lang.Object[] values,
Type[] types)
Create a restriction expressed in SQL with JDBC parameters.
|
static Criterion |
sqlRestriction(java.lang.String sql,
java.lang.Object value,
Type type)
Create a restriction expressed in SQL with one JDBC parameter.
|
public static Criterion idEq(java.lang.Object value)
value
- The value to use in comparisonIdentifierEqExpression
public static SimpleExpression eq(java.lang.String propertyName, java.lang.Object value)
propertyName
- The name of the propertyvalue
- The value to use in comparisonSimpleExpression
public static Criterion eqOrIsNull(java.lang.String propertyName, java.lang.Object value)
propertyName
- The name of the propertyvalue
- The value to use in comparisoneq(java.lang.String, java.lang.Object)
,
isNull(java.lang.String)
public static SimpleExpression ne(java.lang.String propertyName, java.lang.Object value)
propertyName
- The name of the propertyvalue
- The value to use in comparisonSimpleExpression
public static Criterion neOrIsNotNull(java.lang.String propertyName, java.lang.Object value)
propertyName
- The name of the propertyvalue
- The value to use in comparisonne(java.lang.String, java.lang.Object)
,
isNotNull(java.lang.String)
public static SimpleExpression like(java.lang.String propertyName, java.lang.Object value)
propertyName
- The name of the propertyvalue
- The value to use in comparisonSimpleExpression
public static SimpleExpression like(java.lang.String propertyName, java.lang.String value, MatchMode matchMode)
propertyName
- The name of the propertyvalue
- The value to use in comparisonmatchMode
- The match mode to use in comparisonSimpleExpression
public static Criterion ilike(java.lang.String propertyName, java.lang.Object value)
propertyName
- The name of the propertyvalue
- The value to use in comparisonLikeExpression
public static Criterion ilike(java.lang.String propertyName, java.lang.String value, MatchMode matchMode)
propertyName
- The name of the propertyvalue
- The value to use in comparisonmatchMode
- The match mode to use in comparisonLikeExpression
public static SimpleExpression gt(java.lang.String propertyName, java.lang.Object value)
propertyName
- The name of the propertyvalue
- The value to use in comparisonSimpleExpression
public static SimpleExpression lt(java.lang.String propertyName, java.lang.Object value)
propertyName
- The name of the propertyvalue
- The value to use in comparisonSimpleExpression
public static SimpleExpression le(java.lang.String propertyName, java.lang.Object value)
propertyName
- The name of the propertyvalue
- The value to use in comparisonSimpleExpression
public static SimpleExpression ge(java.lang.String propertyName, java.lang.Object value)
propertyName
- The name of the propertyvalue
- The value to use in comparisonSimpleExpression
public static Criterion between(java.lang.String propertyName, java.lang.Object low, java.lang.Object high)
propertyName
- The name of the propertylow
- The low valuehigh
- The high valueBetweenExpression
public static Criterion in(java.lang.String propertyName, java.lang.Object... values)
propertyName
- The name of the propertyvalues
- The literal values to use in the IN restrictionInExpression
public static Criterion in(java.lang.String propertyName, java.util.Collection values)
propertyName
- The name of the propertyvalues
- The literal values to use in the IN restrictionInExpression
public static Criterion isNull(java.lang.String propertyName)
propertyName
- The name of the propertyNullExpression
public static Criterion isNotNull(java.lang.String propertyName)
propertyName
- The property nameNotNullExpression
public static PropertyExpression eqProperty(java.lang.String propertyName, java.lang.String otherPropertyName)
propertyName
- One property nameotherPropertyName
- The other property namePropertyExpression
public static PropertyExpression neProperty(java.lang.String propertyName, java.lang.String otherPropertyName)
propertyName
- One property nameotherPropertyName
- The other property namePropertyExpression
public static PropertyExpression ltProperty(java.lang.String propertyName, java.lang.String otherPropertyName)
propertyName
- One property nameotherPropertyName
- The other property namePropertyExpression
public static PropertyExpression leProperty(java.lang.String propertyName, java.lang.String otherPropertyName)
propertyName
- One property nameotherPropertyName
- The other property namePropertyExpression
public static PropertyExpression gtProperty(java.lang.String propertyName, java.lang.String otherPropertyName)
propertyName
- One property nameotherPropertyName
- The other property namePropertyExpression
public static PropertyExpression geProperty(java.lang.String propertyName, java.lang.String otherPropertyName)
propertyName
- One property nameotherPropertyName
- The other property namePropertyExpression
public static LogicalExpression and(Criterion lhs, Criterion rhs)
lhs
- One expressionrhs
- The other expressionpublic static Conjunction and(Criterion... predicates)
predicates
- The predicates making up the initial junctionpublic static LogicalExpression or(Criterion lhs, Criterion rhs)
lhs
- One expressionrhs
- The other expressionpublic static Disjunction or(Criterion... predicates)
predicates
- The predicates making up the initial junctionpublic static Criterion not(Criterion expression)
expression
- The expression to be negatedNotExpression
public static Criterion sqlRestriction(java.lang.String sql, java.lang.Object[] values, Type[] types)
sql
- The SQL restrictionvalues
- The parameter valuestypes
- The parameter typesSQLCriterion
public static Criterion sqlRestriction(java.lang.String sql, java.lang.Object value, Type type)
sql
- The SQL restrictionvalue
- The parameter valuetype
- The parameter typeSQLCriterion
public static Criterion sqlRestriction(java.lang.String sql)
sql
- The SQL restrictionSQLCriterion
public static Conjunction conjunction()
Junction.add(Criterion)
public static Conjunction conjunction(Criterion... conditions)
conditions
- The initial set of conditions to put into the Conjunctionpublic static Disjunction disjunction()
Junction.add(Criterion)
public static Disjunction disjunction(Criterion... conditions)
conditions
- The initial set of conditions to put into the Disjunctionpublic static Criterion allEq(java.util.Map<java.lang.String,?> propertyNameValues)
propertyNameValues
- a map from property names to valuesConjunction
public static Criterion isEmpty(java.lang.String propertyName)
propertyName
- The name of the collection propertyEmptyExpression
public static Criterion isNotEmpty(java.lang.String propertyName)
propertyName
- The name of the collection propertyNotEmptyExpression
public static Criterion sizeEq(java.lang.String propertyName, int size)
propertyName
- The name of the collection propertysize
- The size to use in comparisonSizeExpression
public static Criterion sizeNe(java.lang.String propertyName, int size)
propertyName
- The name of the collection propertysize
- The size to use in comparisonSizeExpression
public static Criterion sizeGt(java.lang.String propertyName, int size)
propertyName
- The name of the collection propertysize
- The size to use in comparisonSizeExpression
public static Criterion sizeLt(java.lang.String propertyName, int size)
propertyName
- The name of the collection propertysize
- The size to use in comparisonSizeExpression
public static Criterion sizeGe(java.lang.String propertyName, int size)
propertyName
- The name of the collection propertysize
- The size to use in comparisonSizeExpression
public static Criterion sizeLe(java.lang.String propertyName, int size)
propertyName
- The name of the collection propertysize
- The size to use in comparisonSizeExpression
public static NaturalIdentifier naturalId()
NaturalIdentifier
,
Session.byNaturalId(Class)
,
Session.byNaturalId(String)
,
Session.bySimpleNaturalId(Class)
,
Session.bySimpleNaturalId(String)
Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.