HHH-11942 - ANTLR parser should fail when providing an extra parenthesis
Add replicating test case
This commit is contained in:
parent
fcefe7f3b8
commit
6390471d55
|
@ -79,6 +79,7 @@ import org.jboss.logging.Logger;
|
||||||
|
|
||||||
import static org.hibernate.testing.junit4.ExtraAssertions.assertClassAssignability;
|
import static org.hibernate.testing.junit4.ExtraAssertions.assertClassAssignability;
|
||||||
import static org.hibernate.testing.junit4.ExtraAssertions.assertTyping;
|
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.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
@ -3784,6 +3785,22 @@ public class ASTParserLoadingTest extends BaseCoreFunctionalTestCase {
|
||||||
session.close();
|
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(
|
@RequiresDialectFeature(
|
||||||
value = DialectChecks.SupportSubqueryAsLeftHandSideInPredicate.class,
|
value = DialectChecks.SupportSubqueryAsLeftHandSideInPredicate.class,
|
||||||
comment = "Database does not support using subquery as singular value expression"
|
comment = "Database does not support using subquery as singular value expression"
|
||||||
|
|
Loading…
Reference in New Issue