diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/criteria/alias/CriteriaMultiselectAliasTest.java b/hibernate-core/src/test/java/org/hibernate/jpa/test/criteria/alias/CriteriaMultiselectAliasTest.java index 2676e52649..933f97c83b 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/criteria/alias/CriteriaMultiselectAliasTest.java +++ b/hibernate-core/src/test/java/org/hibernate/jpa/test/criteria/alias/CriteriaMultiselectAliasTest.java @@ -104,6 +104,23 @@ public class CriteriaMultiselectAliasTest extends BaseEntityManagerFunctionalTes } ); } + @Test + @TestForIssue(jiraKey = "HHH-13192") + public void testNoAliasInWhereClauseSimplified() { + doInJPA( this::entityManagerFactory, entityManager -> { + CriteriaBuilder cb = entityManager.getCriteriaBuilder(); + CriteriaQuery criteriaQuery = cb.createQuery(); + Root root = criteriaQuery.from( Book.class ); + criteriaQuery.where( cb.equal( root.get( "id" ), cb.parameter( Integer.class, "id" ) ) ); + criteriaQuery.select( root.get( "id" ).alias( "x" ) ); + + List results = entityManager.createQuery( criteriaQuery ) + .setParameter( "id", 1 ) + .getResultList(); + assertEquals( 1, (int) results.get( 0 ) ); + } ); + } + @Entity(name = "Book") public static class Book {