
org.hibernate.criterion.AliasedProjection Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hibernate Show documentation
Show all versions of hibernate Show documentation
Relational Persistence for Java
//$Id: AliasedProjection.java 5685 2005-02-12 07:19:50Z steveebersole $
package org.hibernate.criterion;
import org.hibernate.Criteria;
import org.hibernate.HibernateException;
import org.hibernate.type.Type;
/**
* @author Gavin King
*/
public class AliasedProjection implements Projection {
private final Projection projection;
private final String alias;
public String toString() {
return projection.toString() + " as " + alias;
}
protected AliasedProjection(Projection projection, String alias) {
this.projection = projection;
this.alias = alias;
}
public String toSqlString(Criteria criteria, int position, CriteriaQuery criteriaQuery)
throws HibernateException {
return projection.toSqlString(criteria, position, criteriaQuery);
}
public String toGroupSqlString(Criteria criteria, CriteriaQuery criteriaQuery)
throws HibernateException {
return projection.toGroupSqlString(criteria, criteriaQuery);
}
public Type[] getTypes(Criteria criteria, CriteriaQuery criteriaQuery)
throws HibernateException {
return projection.getTypes(criteria, criteriaQuery);
}
public String[] getColumnAliases(int loc) {
return projection.getColumnAliases(loc);
}
public Type[] getTypes(String alias, Criteria criteria, CriteriaQuery criteriaQuery)
throws HibernateException {
return this.alias.equals(alias) ?
getTypes(criteria, criteriaQuery) :
null;
}
public String[] getColumnAliases(String alias, int loc) {
return this.alias.equals(alias) ?
getColumnAliases(loc) :
null;
}
public String[] getAliases() {
return new String[]{ alias };
}
public boolean isGrouped() {
return projection.isGrouped();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy