FileDocCategorySizeDatePackage
PropertyExpression.javaAPI DocHibernate 3.2.51566Sat Feb 12 00:19:50 GMT 2005org.hibernate.criterion

PropertyExpression

public class PropertyExpression extends Object implements Criterion
superclass for comparisons between two properties (with SQL binary operators)
author
Gavin King

Fields Summary
private final String
propertyName
private final String
otherPropertyName
private final String
op
private static final org.hibernate.engine.TypedValue[]
NO_TYPED_VALUES
Constructors Summary
protected PropertyExpression(String propertyName, String otherPropertyName, String op)


	       
		this.propertyName = propertyName;
		this.otherPropertyName = otherPropertyName;
		this.op = op;
	
Methods Summary
public java.lang.StringgetOp()

		return op;
	
public org.hibernate.engine.TypedValue[]getTypedValues(org.hibernate.Criteria criteria, CriteriaQuery criteriaQuery)

		return NO_TYPED_VALUES;
	
public java.lang.StringtoSqlString(org.hibernate.Criteria criteria, CriteriaQuery criteriaQuery)

		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!
	
public java.lang.StringtoString()

		return propertyName + getOp() + otherPropertyName;