HHH-9549 : Selecting treated root generates invalid HQL (test case)

(cherry picked from commit ea57113e81)
(cherry picked from commit bf3130cd1c)
This commit is contained in:
Emond Papegaaij 2014-12-22 14:48:29 +01:00 committed by Gail Badner
parent 982c6fc0e8
commit 859fe300c7
1 changed files with 10 additions and 0 deletions

View File

@ -129,6 +129,16 @@ public class TreatKeywordTest extends BaseEntityManagerFunctionalTestCase {
em.close();
}
@Test
public void treatRoot() {
EntityManager em = getOrCreateEntityManager();
CriteriaBuilder builder = em.getCriteriaBuilder();
CriteriaQuery<Human> criteria = builder.createQuery( Human.class );
Root<Animal> root = criteria.from( Animal.class );
criteria.select( builder.treat( root, Human.class ) );
em.createQuery( criteria ).getResultList();
em.close();
}
}