List of usage examples for javax.persistence.criteria SetJoin get
<Y> Path<Y> get(SingularAttribute<? super X, Y> attribute);
From source file:org.ngrinder.perftest.repository.TagSpecification.java
/** * Get the {@link Specification} which checks if the tag has corresponding perfTests. * * @return {@link Specification}/*from ww w. j av a2 s . c o m*/ */ public static Specification<Tag> hasPerfTest() { return new Specification<Tag>() { @Override public Predicate toPredicate(Root<Tag> root, CriteriaQuery<?> query, CriteriaBuilder cb) { SetJoin<Object, Object> join = root.joinSet("perfTests"); query.groupBy(root.get("id")); return join.get("id").isNotNull(); } }; }
From source file:org.ngrinder.perftest.repository.PerfTestSpecification.java
/** * Get the {@link Specification} checking if the {@link PerfTest#getTags()} has the given tagValue. * * @param tagValue tagValue/*from w ww . ja v a2 s . com*/ * @return {@link Specification} */ public static Specification<PerfTest> hasTag(final String tagValue) { return new Specification<PerfTest>() { @Override public Predicate toPredicate(Root<PerfTest> root, CriteriaQuery<?> query, CriteriaBuilder cb) { SetJoin<Object, Object> join = root.joinSet("tags"); return cb.equal(join.get("tagValue"), tagValue); } }; }