use of org.hibernate.jpa.test.metamodel.Article 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.jpa.test.metamodel.Article 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();
});
}
Aggregations