HHH-6876 - Test case
This commit is contained in:
parent
a89a9f33b2
commit
3a0c725cf3
|
@ -23,10 +23,13 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.ejb.criteria.basic;
|
package org.hibernate.ejb.criteria.basic;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.TypedQuery;
|
import javax.persistence.TypedQuery;
|
||||||
import javax.persistence.criteria.CriteriaBuilder;
|
import javax.persistence.criteria.CriteriaBuilder;
|
||||||
|
@ -35,18 +38,18 @@ import javax.persistence.criteria.ParameterExpression;
|
||||||
import javax.persistence.criteria.Predicate;
|
import javax.persistence.criteria.Predicate;
|
||||||
import javax.persistence.criteria.Root;
|
import javax.persistence.criteria.Root;
|
||||||
|
|
||||||
import org.junit.After;
|
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import org.hibernate.Query;
|
import org.hibernate.Query;
|
||||||
|
import org.hibernate.dialect.H2Dialect;
|
||||||
import org.hibernate.ejb.metamodel.AbstractMetamodelSpecificTest;
|
import org.hibernate.ejb.metamodel.AbstractMetamodelSpecificTest;
|
||||||
import org.hibernate.ejb.metamodel.Phone;
|
import org.hibernate.ejb.metamodel.Phone;
|
||||||
import org.hibernate.ejb.metamodel.Product;
|
import org.hibernate.ejb.metamodel.Product;
|
||||||
import org.hibernate.ejb.metamodel.Product_;
|
import org.hibernate.ejb.metamodel.Product_;
|
||||||
import org.hibernate.internal.AbstractQueryImpl;
|
import org.hibernate.internal.AbstractQueryImpl;
|
||||||
|
import org.hibernate.testing.RequiresDialect;
|
||||||
import static org.junit.Assert.assertEquals;
|
import org.hibernate.testing.TestForIssue;
|
||||||
|
import org.junit.After;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests that various expressions operate as expected
|
* Tests that various expressions operate as expected
|
||||||
|
@ -97,6 +100,21 @@ public class ExpressionsTest extends AbstractMetamodelSpecificTest {
|
||||||
em.close();
|
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
|
@Test
|
||||||
public void testEmptyConjunctionIsTrue() {
|
public void testEmptyConjunctionIsTrue() {
|
||||||
EntityManager em = getOrCreateEntityManager();
|
EntityManager em = getOrCreateEntityManager();
|
||||||
|
|
Loading…
Reference in New Issue