use of org.hibernate.query.criteria.HibernateCriteriaBuilder in project hibernate-orm by hibernate.
the class PluralAttributeExpressionsTest method testEntityMapIsEmptyCriteria.
@Test
@TestForIssue(jiraKey = "HHH-11225")
public void testEntityMapIsEmptyCriteria() {
doInJPA(this::entityManagerFactory, entityManager -> {
final HibernateCriteriaBuilder cb = (HibernateCriteriaBuilder) entityManager.getCriteriaBuilder();
final CriteriaQuery<Article> criteria = cb.createQuery(Article.class);
final Root<Article> root = criteria.from(Article.class);
criteria.select(root).where(cb.isEmpty(root.get(Article_.translations)));
entityManager.createQuery(criteria).getResultList();
});
}
use of org.hibernate.query.criteria.HibernateCriteriaBuilder in project hibernate-orm by hibernate.
the class PluralAttributeExpressionsTest method testEntityMapSizeCriteria.
@Test
@TestForIssue(jiraKey = "HHH-11225")
public void testEntityMapSizeCriteria() {
doInJPA(this::entityManagerFactory, entityManager -> {
final HibernateCriteriaBuilder cb = (HibernateCriteriaBuilder) entityManager.getCriteriaBuilder();
final CriteriaQuery<Article> criteria = cb.createQuery(Article.class);
final Root<Article> root = criteria.from(Article.class);
criteria.select(root).where(cb.gt(cb.mapSize(root.get(Article_.translations)), 1));
entityManager.createQuery(criteria).getResultList();
});
}
use of org.hibernate.query.criteria.HibernateCriteriaBuilder in project hibernate-orm by hibernate.
the class PluralAttributeExpressionsTest method testCollectionIsEmptyCriteria.
@Test
public void testCollectionIsEmptyCriteria() {
doInJPA(this::entityManagerFactory, entityManager -> {
final HibernateCriteriaBuilder cb = (HibernateCriteriaBuilder) entityManager.getCriteriaBuilder();
final CriteriaQuery<Address> criteria = cb.createQuery(Address.class);
final Root<Address> root = criteria.from(Address.class);
criteria.select(root).where(cb.isEmpty(root.get(Address_.phones)));
entityManager.createQuery(criteria).getResultList();
});
}
use of org.hibernate.query.criteria.HibernateCriteriaBuilder in project hibernate-orm by hibernate.
the class PluralAttributeExpressionsTest method testElementMapSizeCriteria.
@Test
@TestForIssue(jiraKey = "HHH-11225")
public void testElementMapSizeCriteria() {
doInJPA(this::entityManagerFactory, entityManager -> {
final HibernateCriteriaBuilder cb = (HibernateCriteriaBuilder) entityManager.getCriteriaBuilder();
final CriteriaQuery<MapEntity> criteria = cb.createQuery(MapEntity.class);
final Root<MapEntity> root = criteria.from(MapEntity.class);
criteria.select(root).where(cb.gt(cb.mapSize(root.get(MapEntity_.localized)), 1));
entityManager.createQuery(criteria).getResultList();
});
}
use of org.hibernate.query.criteria.HibernateCriteriaBuilder in project hibernate-orm by hibernate.
the class PluralAttributeExpressionsTest method testElementMapIsEmptyCriteria.
@Test
@TestForIssue(jiraKey = "HHH-11225")
@FailureExpected(jiraKey = "HHH-6686")
public void testElementMapIsEmptyCriteria() {
doInJPA(this::entityManagerFactory, entityManager -> {
final HibernateCriteriaBuilder cb = (HibernateCriteriaBuilder) entityManager.getCriteriaBuilder();
final CriteriaQuery<MapEntity> criteria = cb.createQuery(MapEntity.class);
final Root<MapEntity> root = criteria.from(MapEntity.class);
criteria.select(root).where(cb.isMapEmpty(root.get(MapEntity_.localized)));
entityManager.createQuery(criteria).getResultList();
});
}
Aggregations