Java Code Examples for javax.persistence.criteria.CriteriaBuilder#isNotEmpty()

The following examples show how to use javax.persistence.criteria.CriteriaBuilder#isNotEmpty() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ActionZhengwuDingdingPerson.java    From o2oa with GNU Affero General Public License v3.0 5 votes vote down vote up
private List<Person> listPerson(Business business) throws Exception {
	EntityManager em = business.entityManagerContainer().get(Person.class);
	CriteriaBuilder cb = em.getCriteriaBuilder();
	CriteriaQuery<Person> cq = cb.createQuery(Person.class);
	Root<Person> root = cq.from(Person.class);
	Predicate p = cb.isNotEmpty(root.get(Person.zhengwuDingdingId_FIELDNAME));
	List<Person> os = em.createQuery(cq.select(root).where(p).distinct(true)).getResultList();
	return os;
}
 
Example 2
Source File: ActionZhengwuDingdingPerson.java    From o2oa with GNU Affero General Public License v3.0 5 votes vote down vote up
private List<Unit> listUnit(Business business) throws Exception {
	EntityManager em = business.entityManagerContainer().get(Unit.class);
	CriteriaBuilder cb = em.getCriteriaBuilder();
	CriteriaQuery<Unit> cq = cb.createQuery(Unit.class);
	Root<Unit> root = cq.from(Unit.class);
	Predicate p = cb.isNotEmpty(root.get(Unit.zhengwuDingdingId_FIELDNAME));
	List<Unit> os = em.createQuery(cq.select(root).where(p).distinct(true)).getResultList();
	os = os.stream().sorted(Comparator.comparing(Unit::getOrderNumber, Comparator.nullsLast(Integer::compareTo)))
			.collect(Collectors.toList());
	return os;
}
 
Example 3
Source File: AssociatedWithPullRequestsCriteria.java    From onedev with MIT License 4 votes vote down vote up
@Override
public Predicate getPredicate(Root<Build> root, CriteriaBuilder builder) {
	return builder.isNotEmpty(root.get(Build.PROP_VERIFICATIONS)); 
}