diff --git a/hibernate-core/src/test/java/org/hibernate/test/hql/ASTParserLoadingTest.java b/hibernate-core/src/test/java/org/hibernate/test/hql/ASTParserLoadingTest.java index 58149ab0c2..f6d861b505 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/hql/ASTParserLoadingTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/hql/ASTParserLoadingTest.java @@ -79,6 +79,7 @@ import org.jboss.logging.Logger; import static org.hibernate.testing.junit4.ExtraAssertions.assertClassAssignability; import static org.hibernate.testing.junit4.ExtraAssertions.assertTyping; +import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; @@ -3784,6 +3785,22 @@ public class ASTParserLoadingTest extends BaseCoreFunctionalTestCase { session.close(); } + @Test + @FailureExpected( jiraKey = "HHH-11942" ) + public void testOrderByExtraParenthesis() throws Exception { + doInHibernate( this::sessionFactory, session -> { + session.createQuery( + "select a from Product a " + + "where " + + "coalesce(a.description, :description) = :description ) " + + "order by a.description ", Product.class) + .setParameter( "description", "desc" ) + .getResultList(); + + fail("Should throw parsing exception"); + } ); + } + @RequiresDialectFeature( value = DialectChecks.SupportSubqueryAsLeftHandSideInPredicate.class, comment = "Database does not support using subquery as singular value expression"