HHH-12565 Test showing TYPE for a TPC hierarchy leaf subtype fails

This commit is contained in:
Christian Beikov 2018-05-11 20:42:36 +02:00 committed by Steve Ebersole
parent ecd6f503f8
commit f972dd4d29
1 changed files with 14 additions and 8 deletions

View File

@ -6,10 +6,6 @@
*/
package org.hibernate.test.unionsubclass3;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.query.Query;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.junit.Test;
@ -23,8 +19,6 @@ import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.ManyToOne;
import org.hibernate.test.locking.A;
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
import static org.junit.Assert.assertEquals;
@ -81,8 +75,7 @@ public class UnionSubclassTest extends BaseCoreFunctionalTestCase {
session.persist(child2);
session.persist(child3);
session.persist(child4);
} );
});
doInHibernate( this::sessionFactory, session -> {
List results = session.createQuery(
"select c " +
@ -98,6 +91,19 @@ public class UnionSubclassTest extends BaseCoreFunctionalTestCase {
} );
}
@Test
@TestForIssue( jiraKey = "HHH-12565" )
public void typeOfLeafTPC() {
doInHibernate( this::sessionFactory, session -> {
List results = session.createQuery(
"select TYPE(f) " +
"from Father f" +
" where f.id = -1")
.getResultList();
assertEquals(0, results.size());
} );
}
@Entity(name = "Child")
public static class Child
{