HHH-4881: Added test cases for parameterized discriminator type
This commit is contained in:
parent
308847f526
commit
fb1b483721
|
@ -88,6 +88,8 @@ public class SimpleInheritanceTest extends BaseCoreFunctionalTestCase {
|
|||
assertEquals( s.createQuery("from org.hibernate.test.discriminator.Person").list().size(), 3 );
|
||||
assertEquals( s.createQuery("from org.hibernate.test.discriminator.Person p where p.class = org.hibernate.test.discriminator.Person").list().size(), 1 );
|
||||
assertEquals( s.createQuery("from org.hibernate.test.discriminator.Person p where p.class = org.hibernate.test.discriminator.Customer").list().size(), 1 );
|
||||
assertEquals( s.createQuery("from org.hibernate.test.discriminator.Person p where type(p) = :who").setParameter("who", Person.class).list().size(), 1 );
|
||||
assertEquals( s.createQuery("from org.hibernate.test.discriminator.Person p where type(p) in :who").setParameterList("who", new Class[] {Customer.class, Person.class}).list().size(), 2 );
|
||||
s.clear();
|
||||
|
||||
List customers = s.createQuery("from org.hibernate.test.discriminator.Customer").list();
|
||||
|
|
|
@ -88,6 +88,8 @@ public class JoinedSubclassTest extends BaseCoreFunctionalTestCase {
|
|||
assertEquals( s.createQuery("from Person").list().size(), 3 );
|
||||
assertEquals( s.createQuery("from Person p where p.class = Customer").list().size(), 1 );
|
||||
assertEquals( s.createQuery("from Person p where p.class = Person").list().size(), 1 );
|
||||
assertEquals( s.createQuery("from Person p where type(p) in :who").setParameter("who", Customer.class).list().size(), 1 );
|
||||
assertEquals( s.createQuery("from Person p where type(p) in :who").setParameterList("who", new Class[] {Customer.class, Person.class}).list().size(), 2 );
|
||||
s.clear();
|
||||
|
||||
List customers = s.createQuery("from Customer c left join fetch c.salesperson").list();
|
||||
|
|
|
@ -318,6 +318,8 @@ public class UnionSubclassTest extends BaseCoreFunctionalTestCase {
|
|||
|
||||
assertEquals( s.createQuery("from Being").list().size(), 2 );
|
||||
assertEquals( s.createQuery("from Being b where b.class = Alien").list().size(), 1 );
|
||||
assertEquals( s.createQuery("from Being b where type(b) = :what").setParameter("what", Alien.class).list().size(), 1 );
|
||||
assertEquals( s.createQuery("from Being b where type(b) in :what").setParameterList("what", new Class[] { Alien.class, Human.class }).list().size(), 2 );
|
||||
assertEquals( s.createQuery("from Alien").list().size(), 1 );
|
||||
s.clear();
|
||||
|
||||
|
|
|
@ -86,6 +86,8 @@ public class UnionSubclassTest extends BaseCoreFunctionalTestCase {
|
|||
assertEquals( s.createQuery("from Person").list().size(), 3 );
|
||||
assertEquals( s.createQuery("from Person p where p.class = Customer").list().size(), 1 );
|
||||
assertEquals( s.createQuery("from Person p where p.class = Person").list().size(), 1 );
|
||||
assertEquals( s.createQuery("from Person p where type(p) in :who").setParameter("who", Customer.class).list().size(), 1 );
|
||||
assertEquals( s.createQuery("from Person p where type(p) in :who").setParameterList("who", new Class[] {Customer.class, Person.class}).list().size(), 2 );
|
||||
s.clear();
|
||||
|
||||
List customers = s.createQuery("from Customer c left join fetch c.salesperson").list();
|
||||
|
|
Loading…
Reference in New Issue