Example usage for org.hibernate.criterion Projection getColumnAliases

List of usage examples for org.hibernate.criterion Projection getColumnAliases

Introduction

In this page you can find the example usage for org.hibernate.criterion Projection getColumnAliases.

Prototype

public String[] getColumnAliases(int position);

Source Link

Document

Get the SQL column aliases used by this projection for the columns it writes for inclusion into the SELECT clause ( #toSqlString .

Usage

From source file:de.cosmocode.hibernate.CustomProjectionList.java

License:Apache License

@Override
public String toSqlString(Criteria criteria, int loc, CriteriaQuery criteriaQuery) throws HibernateException {
    final StringBuilder buf = new StringBuilder();
    for (int i = 0; i < getLength(); i++) {
        final Projection proj = getProjection(i);
        buf.append(proj.toSqlString(criteria, loc, criteriaQuery));
        proj.getColumnAliases(loc);
        if (i < getLength() - 1 && !getProjection(i + 1).isGrouped())
            buf.append(", ");
    }//from w ww .  j  ava  2 s  .c  om
    return buf.toString();
}