HHH-6876 - Test case

This commit is contained in:
Lukasz Antoniak 2013-02-02 08:48:35 +01:00 committed by Brett Meyer
parent f4b45eb5a9
commit dc311bb027
1 changed files with 18 additions and 0 deletions

View File

@ -40,11 +40,14 @@ import org.junit.Before;
import org.junit.Test;
import org.hibernate.Query;
import org.hibernate.dialect.H2Dialect;
import org.hibernate.jpa.test.metamodel.AbstractMetamodelSpecificTest;
import org.hibernate.jpa.test.metamodel.Phone;
import org.hibernate.jpa.test.metamodel.Product;
import org.hibernate.jpa.test.metamodel.Product_;
import org.hibernate.internal.AbstractQueryImpl;
import org.hibernate.testing.RequiresDialect;
import org.hibernate.testing.TestForIssue;
import static org.junit.Assert.assertEquals;
@ -97,6 +100,21 @@ public class ExpressionsTest extends AbstractMetamodelSpecificTest {
em.close();
}
@Test
@TestForIssue( jiraKey = "HHH-6876" )
@RequiresDialect( H2Dialect.class )
public void testEmptyInList() {
EntityManager em = getOrCreateEntityManager();
em.getTransaction().begin();
CriteriaQuery<Product> criteria = builder.createQuery( Product.class );
Root<Product> from = criteria.from( Product.class );
criteria.where( from.get( Product_.partNumber ).in() ); // empty IN list
List<Product> result = em.createQuery( criteria ).getResultList();
assertEquals( 0, result.size() );
em.getTransaction().commit();
em.close();
}
@Test
public void testEmptyConjunctionIsTrue() {
EntityManager em = getOrCreateEntityManager();