Skip to content

Commit

Permalink
HHH-2951 Restrictions.eq when passed null, should create a NullRestri…
Browse files Browse the repository at this point in the history
…ction
  • Loading branch information
Nikolay Shestakov authored and brmeyer committed Jan 16, 2013
1 parent 991342f commit 70454c9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Expand Up @@ -55,11 +55,11 @@ public SimpleExpression like(String value, MatchMode matchMode) {
return Restrictions.like(getPropertyName(), value, matchMode);
}

public SimpleExpression eq(Object value) {
public Criterion eq(Object value) {
return Restrictions.eq(getPropertyName(), value);
}

public SimpleExpression ne(Object value) {
public Criterion ne(Object value) {
return Restrictions.ne(getPropertyName(), value);
}

Expand Down
Expand Up @@ -61,7 +61,10 @@ public static Criterion idEq(Object value) {
* @param value
* @return Criterion
*/
public static SimpleExpression eq(String propertyName, Object value) {
public static Criterion eq(String propertyName, Object value) {
if (null == value) {
return isNull(propertyName);
}
return new SimpleExpression(propertyName, value, "=");
}
/**
Expand All @@ -70,7 +73,10 @@ public static SimpleExpression eq(String propertyName, Object value) {
* @param value
* @return Criterion
*/
public static SimpleExpression ne(String propertyName, Object value) {
public static Criterion ne(String propertyName, Object value) {
if (null == value) {
return isNotNull(propertyName);
}
return new SimpleExpression(propertyName, value, "<>");
}
/**
Expand Down

0 comments on commit 70454c9

Please sign in to comment.