HHH-13192 Add a simplified test case

This commit is contained in:
Guillaume Smet 2019-01-16 15:54:50 +01:00
parent 67ec2d07cc
commit fcef483d65
1 changed files with 17 additions and 0 deletions

View File

@ -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<Object> criteriaQuery = cb.createQuery();
Root<Book> 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<Object> results = entityManager.createQuery( criteriaQuery )
.setParameter( "id", 1 )
.getResultList();
assertEquals( 1, (int) results.get( 0 ) );
} );
}
@Entity(name = "Book")
public static class Book {