FileDocCategorySizeDatePackage
CountProjection.javaAPI DocHibernate 3.2.51188Tue May 09 02:40:12 BST 2006org.hibernate.criterion

CountProjection

public class CountProjection extends AggregateProjection
A count
author
Gavin King

Fields Summary
private boolean
distinct
Constructors Summary
protected CountProjection(String prop)

		super("count", prop);
	
Methods Summary
public org.hibernate.type.Type[]getTypes(org.hibernate.Criteria criteria, CriteriaQuery criteriaQuery)

		return new Type[] { Hibernate.INTEGER };
	
public org.hibernate.criterion.CountProjectionsetDistinct()

		distinct = true;
		return this;
	
public java.lang.StringtoSqlString(org.hibernate.Criteria criteria, int position, CriteriaQuery criteriaQuery)

		StringBuffer buf = new StringBuffer();
		buf.append("count(");
		if (distinct) buf.append("distinct ");
		return buf.append( criteriaQuery.getColumn(criteria, propertyName) )
			.append(") as y")
			.append(position)
			.append('_")
			.toString();
	
public java.lang.StringtoString()

		if(distinct) {
			return "distinct " + super.toString();
		} else {
			return super.toString();
		}