diff --git a/core/src/main/java/org/hibernate/criterion/CriteriaQuery.java b/core/src/main/java/org/hibernate/criterion/CriteriaQuery.java index 0d8c2a562d..7d8043d45d 100755 --- a/core/src/main/java/org/hibernate/criterion/CriteriaQuery.java +++ b/core/src/main/java/org/hibernate/criterion/CriteriaQuery.java @@ -44,10 +44,18 @@ public interface CriteriaQuery { /** * Get the names of the columns mapped by a property path, * ignoring projection aliases + * @throws org.hibernate.QueryException if the property maps to more than 1 column */ public String getColumn(Criteria criteria, String propertyPath) throws HibernateException; + /** + * Get the names of the columns mapped by a property path, + * ignoring projection aliases + */ + public String[] getColumns(String propertyPath, Criteria criteria) + throws HibernateException; + /** * Get the type of a property path, ignoring projection aliases */ diff --git a/core/src/main/java/org/hibernate/criterion/PropertyProjection.java b/core/src/main/java/org/hibernate/criterion/PropertyProjection.java index 0df889eebd..8ffa5e2107 100755 --- a/core/src/main/java/org/hibernate/criterion/PropertyProjection.java +++ b/core/src/main/java/org/hibernate/criterion/PropertyProjection.java @@ -27,6 +27,7 @@ import org.hibernate.Criteria; import org.hibernate.HibernateException; import org.hibernate.type.Type; +import org.hibernate.util.StringHelper; /** * A property value, or grouped property value @@ -62,7 +63,7 @@ public Type[] getTypes(Criteria criteria, CriteriaQuery criteriaQuery) public String toSqlString(Criteria criteria, int position, CriteriaQuery criteriaQuery) throws HibernateException { StringBuffer buf = new StringBuffer(); - String[] cols = criteriaQuery.getColumnsUsingProjection( criteria, propertyName ); + String[] cols = criteriaQuery.getColumns( propertyName, criteria ); for ( int i=0; i