HHH-4881: Added test cases for parameterized discriminator type

This commit is contained in:
James Gilbertson 2011-10-07 23:10:20 -06:00 committed by Strong Liu
parent 308847f526
commit fb1b483721
4 changed files with 8 additions and 0 deletions

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();