From 7a17840c16e859eaeb2c9a8889f222b1ffad6915 Mon Sep 17 00:00:00 2001 From: Andrea Boriero Date: Sun, 19 Jun 2016 12:00:49 +0100 Subject: [PATCH] HHH-10729 HHH-9021 HHH-10230 - Fix Issue with literals in select expression (cherry picked from commit e71af130f0c5244d8a7b2ce989b8d18fb578fd22) --- hibernate-core/src/main/antlr/hql-sql.g | 2 +- .../java/org/hibernate/jpa/criteria/CriteriaQueryImpl.java | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/hibernate-core/src/main/antlr/hql-sql.g b/hibernate-core/src/main/antlr/hql-sql.g index d3dc9814b7..b2303bd527 100644 --- a/hibernate-core/src/main/antlr/hql-sql.g +++ b/hibernate-core/src/main/antlr/hql-sql.g @@ -425,7 +425,7 @@ selectExpr | functionCall | count | collectionFunction // elements() or indices() - | literal + | constant | arithmeticExpr | logicalExpr | parameter diff --git a/hibernate-entitymanager/src/main/java/org/hibernate/jpa/criteria/CriteriaQueryImpl.java b/hibernate-entitymanager/src/main/java/org/hibernate/jpa/criteria/CriteriaQueryImpl.java index 1b42f4b3a2..6bf19e1ca3 100755 --- a/hibernate-entitymanager/src/main/java/org/hibernate/jpa/criteria/CriteriaQueryImpl.java +++ b/hibernate-entitymanager/src/main/java/org/hibernate/jpa/criteria/CriteriaQueryImpl.java @@ -110,10 +110,7 @@ public class CriteriaQueryImpl extends AbstractNode implements CriteriaQuery< selection = ( Selection ) criteriaBuilder().tuple( selections ); } else if ( getResultType().isArray() ) { - selection = ( Selection ) criteriaBuilder().array( - ( Class ) getResultType(), - selections - ); + selection = criteriaBuilder().array( getResultType(), selections ); } else if ( Object.class.equals( getResultType() ) ) { switch ( selections.size() ) {