HHH-4881: Merged test case from HHH-5282

This commit is contained in:
James Gilbertson 2011-10-07 23:27:55 -06:00 committed by Strong Liu
parent fb1b483721
commit 1b30c4a9f2
1 changed files with 16 additions and 0 deletions

View File

@ -83,6 +83,22 @@ public class QueryTest extends BaseEntityManagerFunctionalTestCase {
em.close();
}
public void testTypeExpression() throws Exception {
EntityManager em = getOrCreateEntityManager();
em.getTransaction().begin();
Item item = new Item( "Mouse", "Micro$oft mouse" );
em.persist( item );
item = new Item( "Computer", "Apple II" );
em.persist( item );
Query q = em.createQuery( "select i from Item i where TYPE(i) = :itemType" );
q.setParameter( "itemType", Item.class );
List result = q.getResultList();
assertNotNull( result );
assertEquals( 2, result.size() );
em.getTransaction().rollback();
em.close();
}
@Test
public void testParameterList() throws Exception {
final Item item = new Item( "Mouse", "Micro$oft mouse" );