/** * Apply a "greater than or equal" constraint to two properties * * @param propertyName One property name * @param otherPropertyName The other property name * * @return The Criterion * * @see PropertyExpression */ public static PropertyExpression geProperty(String propertyName, String otherPropertyName) { return new PropertyExpression( propertyName, otherPropertyName, ">=" ); }
@Override public String toString() { return propertyName + getOp() + otherPropertyName; }
/** * Apply an "equal" constraint to two properties * * @param propertyName One property name * @param otherPropertyName The other property name * * @return The Criterion * * @see PropertyExpression */ public static PropertyExpression eqProperty(String propertyName, String otherPropertyName) { return new PropertyExpression( propertyName, otherPropertyName, "=" ); }
@Override public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException { final String[] lhsColumns = criteriaQuery.findColumns( propertyName, criteria ); final String[] rhsColumns = criteriaQuery.findColumns( otherPropertyName, criteria ); final String[] comparisons = StringHelper.add( lhsColumns, getOp(), rhsColumns ); if ( comparisons.length > 1 ) { return '(' + String.join( " and ", comparisons ) + ')'; } else { return comparisons[0]; } }
/** * Apply a "less than" constraint to two properties * * @param propertyName One property name * @param otherPropertyName The other property name * * @return The Criterion * * @see PropertyExpression */ public static PropertyExpression ltProperty(String propertyName, String otherPropertyName) { return new PropertyExpression( propertyName, otherPropertyName, "<" ); }
public String toString() { return propertyName + getOp() + otherPropertyName; }
/** * Apply a "not equal" constraint to two properties * * @param propertyName One property name * @param otherPropertyName The other property name * * @return The Criterion * * @see PropertyExpression */ public static PropertyExpression neProperty(String propertyName, String otherPropertyName) { return new PropertyExpression( propertyName, otherPropertyName, "<>" ); }
public String toString() { return propertyName + getOp() + otherPropertyName; }
/** * Apply a "greater than" constraint to two properties * * @param propertyName One property name * @param otherPropertyName The other property name * * @return The Criterion * * @see PropertyExpression */ public static PropertyExpression gtProperty(String propertyName, String otherPropertyName) { return new PropertyExpression( propertyName, otherPropertyName, ">" ); }
public String toString() { return propertyName + getOp() + otherPropertyName; }
/** * Apply a "less than or equal" constraint to two properties * * @param propertyName One property name * @param otherPropertyName The other property name * * @return The Criterion * * @see PropertyExpression */ public static PropertyExpression leProperty(String propertyName, String otherPropertyName) { return new PropertyExpression( propertyName, otherPropertyName, "<=" ); }
public String toString() { return propertyName + getOp() + otherPropertyName; }
/** * Apply a "greater than or equal" constraint to two properties */ public static PropertyExpression geProperty(String propertyName, String otherPropertyName) { return new PropertyExpression(propertyName, otherPropertyName, ">="); } /**
public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException { String[] xcols = criteriaQuery.getColumnsUsingProjection(criteria, propertyName); String[] ycols = criteriaQuery.getColumnsUsingProjection(criteria, otherPropertyName); String result = StringHelper.join( " and ", StringHelper.add(xcols, getOp(), ycols) ); if (xcols.length>1) result = '(' + result + ')'; return result; //TODO: get SQL rendering out of this package! }
/** * Apply a "less than or equal" constraint to two properties */ public static PropertyExpression leProperty(String propertyName, String otherPropertyName) { return new PropertyExpression(propertyName, otherPropertyName, "<="); } /**
public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException { String[] xcols = criteriaQuery.findColumns(propertyName, criteria); String[] ycols = criteriaQuery.findColumns(otherPropertyName, criteria); String result = StringHelper.join( " and ", StringHelper.add( xcols, getOp(), ycols ) ); if (xcols.length>1) result = '(' + result + ')'; return result; //TODO: get SQL rendering out of this package! }
/** * Apply a "greater than" constraint to two properties */ public static PropertyExpression gtProperty(String propertyName, String otherPropertyName) { return new PropertyExpression(propertyName, otherPropertyName, ">"); } /**
public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException { String[] xcols = criteriaQuery.getColumnsUsingProjection(criteria, propertyName); String[] ycols = criteriaQuery.getColumnsUsingProjection(criteria, otherPropertyName); String result = StringHelper.join( " and ", StringHelper.add(xcols, getOp(), ycols) ); if (xcols.length>1) result = '(' + result + ')'; return result; //TODO: get SQL rendering out of this package! }
/** * Apply an "equal" constraint to two properties */ public static PropertyExpression eqProperty(String propertyName, String otherPropertyName) { return new PropertyExpression(propertyName, otherPropertyName, "="); } /**
public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException { String[] xcols = criteriaQuery.findColumns(propertyName, criteria); String[] ycols = criteriaQuery.findColumns(otherPropertyName, criteria); String result = StringHelper.join( " and ", StringHelper.add( xcols, getOp(), ycols ) ); if (xcols.length>1) result = '(' + result + ')'; return result; //TODO: get SQL rendering out of this package! }