HHH-15452 Add test for issue
This commit is contained in:
parent
95c14ada90
commit
0945cae46d
|
@ -28,6 +28,7 @@ import org.junit.jupiter.api.Test;
|
||||||
import jakarta.persistence.TypedQuery;
|
import jakarta.persistence.TypedQuery;
|
||||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
import jakarta.persistence.criteria.CriteriaQuery;
|
import jakarta.persistence.criteria.CriteriaQuery;
|
||||||
|
import jakarta.persistence.criteria.Expression;
|
||||||
import jakarta.persistence.criteria.ParameterExpression;
|
import jakarta.persistence.criteria.ParameterExpression;
|
||||||
import jakarta.persistence.criteria.Predicate;
|
import jakarta.persistence.criteria.Predicate;
|
||||||
import jakarta.persistence.criteria.Root;
|
import jakarta.persistence.criteria.Root;
|
||||||
|
@ -87,6 +88,27 @@ public class ExpressionsTest extends AbstractMetamodelSpecificTest {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestForIssue( jiraKey = "HHH-15452")
|
||||||
|
public void testGetConjunctionExpressionsAndAddPredicate(){
|
||||||
|
inTransaction(
|
||||||
|
entityManager -> {
|
||||||
|
CriteriaBuilder builder = entityManager.getCriteriaBuilder();
|
||||||
|
CriteriaQuery<Product> criteria = builder.createQuery(Product.class);
|
||||||
|
Root<Product> rootClaseGrid = criteria.from(Product.class);
|
||||||
|
|
||||||
|
Predicate conjuncion = builder.conjunction();
|
||||||
|
Predicate expr = builder.equal(rootClaseGrid.get("id"), "NON existing id");
|
||||||
|
// Modifications to the list do not affect the query
|
||||||
|
List<Expression<Boolean>> expressions = conjuncion.getExpressions();
|
||||||
|
expressions.add( expr);
|
||||||
|
|
||||||
|
List<Product> result = entityManager.createQuery( criteria ).getResultList();
|
||||||
|
assertEquals( 1, result.size() );
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestForIssue(jiraKey = "HHH-6876")
|
@TestForIssue(jiraKey = "HHH-6876")
|
||||||
public void testEmptyInList() {
|
public void testEmptyInList() {
|
||||||
|
|
Loading…
Reference in New Issue