use of org.hibernate.criterion.EnhancedProjection in project hibernate-orm by hibernate.
the class CriteriaQueryTranslator method getColumnsUsingProjection.
/**
* Get the names of the columns constrained
* by this criterion.
*/
@Override
public String[] getColumnsUsingProjection(Criteria subcriteria, String propertyName) throws HibernateException {
//first look for a reference to a projection alias
final Projection projection = rootCriteria.getProjection();
String[] projectionColumns = null;
if (projection != null) {
projectionColumns = (projection instanceof EnhancedProjection ? ((EnhancedProjection) projection).getColumnAliases(propertyName, 0, rootCriteria, this) : projection.getColumnAliases(propertyName, 0));
}
if (projectionColumns == null) {
//look for a property
try {
return getColumns(propertyName, subcriteria);
} catch (HibernateException he) {
//not found in inner query , try the outer query
if (outerQueryTranslator != null) {
return outerQueryTranslator.getColumnsUsingProjection(subcriteria, propertyName);
} else {
throw he;
}
}
} else {
//it refers to an alias of a projection
return projectionColumns;
}
}
Aggregations