HHH-2951 Restrictions.eq when passed null, should create a NullRestriction

This commit is contained in:
Nikolay Shestakov 2013-01-04 21:59:16 +06:00 committed by Brett Meyer
parent 6395e57013
commit 265b3d37cf
2 changed files with 10 additions and 4 deletions

View File

@ -55,11 +55,11 @@ public class Property extends PropertyProjection {
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);
}

View File

@ -61,7 +61,10 @@ public class Restrictions {
* @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, "=");
}
/**
@ -70,7 +73,10 @@ public class Restrictions {
* @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, "<>");
}
/**