Package org.hibernate.criterion
Class MoreRestrictions
java.lang.Object
org.hibernate.criterion.MoreRestrictions
Utility functions to ease creation of restrictions. The package was chosen to be
able to pass
escape chars to the
LikeExpression.-
Method Summary
Modifier and TypeMethodDescriptionstatic org.hibernate.criterion.CriterionCreates a criterion that is alwaysfalse.static org.hibernate.criterion.CriterionCreates a criterion that is alwaystrue.static Optional<? extends org.hibernate.criterion.Criterion>static booleanhasConditions(org.hibernate.criterion.Junction j) static org.hibernate.criterion.LikeExpressionCreate a new case-insensitive like expression.static org.hibernate.criterion.LikeExpressionCreate a new case-insensitive like expression.static org.hibernate.criterion.LikeExpressionilike(String propertyName, String value, org.hibernate.criterion.MatchMode matchMode, Character escapeChar) Create a new case-insensitive like expression.static org.hibernate.criterion.LikeExpressionilike(String propertyName, String value, org.hibernate.criterion.MatchMode matchMode, String escapeString) Create a new case-insensitive like expression.static org.hibernate.criterion.LikeExpressionCreate a new case-sensitive like expression.static org.hibernate.criterion.LikeExpressionCreate a new like expression.static org.hibernate.criterion.LikeExpressionCreate a new like expression.static org.hibernate.criterion.LikeExpressionCreate a new case-sensitive like expression.static org.hibernate.criterion.LikeExpressionlike(String propertyName, String value, org.hibernate.criterion.MatchMode matchMode, Character escapeChar, boolean ignoreCase) Create a new like expression.static org.hibernate.criterion.LikeExpressionlike(String propertyName, String value, org.hibernate.criterion.MatchMode matchMode, String escapeString, boolean ignoreCase) Create a new like expression.static Optional<? extends org.hibernate.criterion.Criterion>static Collector<org.hibernate.criterion.Criterion,?, org.hibernate.criterion.Criterion> Create aCollectorthat collects criterions to a conjunction.static Collector<org.hibernate.criterion.Criterion,?, org.hibernate.criterion.Criterion> Create aCollectorthat collects criterions to a disjunction.
-
Method Details
-
ilike
public static org.hibernate.criterion.LikeExpression ilike(String propertyName, String value, Character escapeChar) Create a new case-insensitive like expression.- Parameters:
propertyName- the property namevalue- the value to compare againstescapeChar- the escape char to use- Returns:
- the expression
-
ilike
public static org.hibernate.criterion.LikeExpression ilike(String propertyName, String value, String escapeString) Create a new case-insensitive like expression.- Parameters:
propertyName- the property namevalue- the value to compare againstescapeString- the escape string to use- Returns:
- the expression
-
ilike
public static org.hibernate.criterion.LikeExpression ilike(String propertyName, String value, org.hibernate.criterion.MatchMode matchMode, Character escapeChar) Create a new case-insensitive like expression.- Parameters:
propertyName- the property namevalue- the value to compare againstmatchMode- the match modeescapeChar- the escape char to use- Returns:
- the expression
-
ilike
public static org.hibernate.criterion.LikeExpression ilike(String propertyName, String value, org.hibernate.criterion.MatchMode matchMode, String escapeString) Create a new case-insensitive like expression.- Parameters:
propertyName- the property namevalue- the value to compare againstmatchMode- the match modeescapeString- the escape string to use- Returns:
- the expression
-
like
public static org.hibernate.criterion.LikeExpression like(String propertyName, String value, Character escapeChar, boolean ignoreCase) Create a new like expression.- Parameters:
propertyName- the property namevalue- the value to compare againstescapeChar- the escape char to useignoreCase- if the match should be case-insensitive- Returns:
- the expression
-
like
public static org.hibernate.criterion.LikeExpression like(String propertyName, String value, String escapeString, boolean ignoreCase) Create a new like expression.- Parameters:
propertyName- the property namevalue- the value to compare againstescapeString- the escape string to useignoreCase- if the match should be case-insensitive- Returns:
- the expression
-
like
Create a new case-sensitive like expression.- Parameters:
propertyName- the property namevalue- the value to compare against- Returns:
- the expression
-
like
public static org.hibernate.criterion.LikeExpression like(String propertyName, String value, org.hibernate.criterion.MatchMode matchMode) Create a new case-sensitive like expression.- Parameters:
propertyName- the property namevalue- the value to compare againstmatchMode- the match mode- Returns:
- the expression
-
like
public static org.hibernate.criterion.LikeExpression like(String propertyName, String value, org.hibernate.criterion.MatchMode matchMode, String escapeString, boolean ignoreCase) Create a new like expression.- Parameters:
propertyName- the property namevalue- the value to compare againstmatchMode- the match modeescapeString- the escape string to useignoreCase- if the match should be case-insensitive- Returns:
- the expression
-
like
public static org.hibernate.criterion.LikeExpression like(String propertyName, String value, org.hibernate.criterion.MatchMode matchMode, Character escapeChar, boolean ignoreCase) Create a new like expression.- Parameters:
propertyName- the property namevalue- the value to compare againstmatchMode- the match modeescapeChar- the escape char to useignoreCase- if the match should be case-insensitive- Returns:
- the expression
-
alwaysFalse
public static org.hibernate.criterion.Criterion alwaysFalse()Creates a criterion that is alwaysfalse.- Returns:
- the criterion
-
alwaysTrue
public static org.hibernate.criterion.Criterion alwaysTrue()Creates a criterion that is alwaystrue.- Returns:
- the criterion
-
toDisjunction
public static Collector<org.hibernate.criterion.Criterion,?, toDisjunction()org.hibernate.criterion.Criterion> Create aCollectorthat collects criterions to a disjunction.- Returns:
- the collector
-
toConjunction
public static Collector<org.hibernate.criterion.Criterion,?, toConjunction()org.hibernate.criterion.Criterion> Create aCollectorthat collects criterions to a conjunction.- Returns:
- the collector
-
and
@SafeVarargs public static Optional<? extends org.hibernate.criterion.Criterion> and(Optional<? extends org.hibernate.criterion.Criterion>... criteria) -
or
@SafeVarargs public static Optional<? extends org.hibernate.criterion.Criterion> or(Optional<? extends org.hibernate.criterion.Criterion>... criteria) -
hasConditions
public static boolean hasConditions(org.hibernate.criterion.Junction j)
-