List of usage examples for javax.persistence.criteria Root get
<Y> Path<Y> get(SingularAttribute<? super X, Y> attribute);
From source file:th.co.geniustree.dental.spec.TmpProductSpec.java
public static Specification<TmpProduct> nameUser(final String keyword) { return new Specification<TmpProduct>() { @Override/*from www . j a v a 2 s . co m*/ public Predicate toPredicate(Root<TmpProduct> root, CriteriaQuery<?> cq, CriteriaBuilder cb) { return cb.like(root.get(TmpProduct_.user), keyword); } }; }
From source file:th.co.geniustree.intenship.advisor.spec.AppointmentSpec.java
public static Specification<Appointment> nameLike(final String keyword) { return new Specification() { @Override//from ww w.j ava2 s. c o m public Predicate toPredicate(Root root, CriteriaQuery cq, CriteriaBuilder cb) { return cb.like(cb.upper(root.get(Appointment_.student).get(Student_.name)), keyword.toUpperCase()); } }; }
From source file:th.co.geniustree.intenship.advisor.spec.AppointmentSpec.java
public static Specification<Appointment> nameTeacherLike(final String keyword) { return new Specification() { @Override//from www . j a v a 2 s .c o m public Predicate toPredicate(Root root, CriteriaQuery cq, CriteriaBuilder cb) { return cb.like(cb.upper(root.get(Appointment_.teacher).get(Student_.name)), keyword.toUpperCase()); } }; }
From source file:org.wallride.repository.ArticleSpecifications.java
public static Specification<Article> draft(Article article) { return (root, query, cb) -> { List<Predicate> predicates = new ArrayList<>(); predicates.add(cb.equal(root.get(Article_.drafted), article)); Subquery<Long> subquery = query.subquery(Long.class); Root<Article> p = subquery.from(Article.class); subquery.select(cb.max(p.get(Article_.id))).where(cb.equal(p.get(Article_.drafted), article)); predicates.add(cb.equal(root.get(Article_.id), subquery)); return cb.and(predicates.toArray(new Predicate[0])); };//from w ww .j a v a 2 s .c o m }
From source file:th.co.geniustree.dental.spec.TypeOfMedicalSpec.java
public static Specification<TypeOfMedical> userName(final String keyword) { return new Specification<TypeOfMedical>() { @Override/* ww w .jav a 2 s . c om*/ public Predicate toPredicate(Root<TypeOfMedical> root, CriteriaQuery<?> query, CriteriaBuilder cb) { return cb.like(root.get(TypeOfMedical_.userName), keyword); } }; }
From source file:th.co.geniustree.intenship.advisor.spec.FacultySpec.java
public static Specification<Faculty> nameLike(final String keyword) { return new Specification<Faculty>() { @Override/*from ww w . j a v a2 s . c o m*/ public Predicate toPredicate(Root<Faculty> root, CriteriaQuery<?> cq, CriteriaBuilder cb) { return cb.like(cb.upper(root.get(Faculty_.name)), keyword.toUpperCase()); } }; }
From source file:th.co.geniustree.dental.spec.OrderProductSpecificaton.java
public static Specification<OrderProduct> whereBill(final Integer keyword) { return new Specification<OrderProduct>() { @Override/*w w w.j a v a 2 s.co m*/ public Predicate toPredicate(Root<OrderProduct> root, CriteriaQuery<?> query, CriteriaBuilder cb) { return cb.equal(root.get(OrderProduct_.bill).get(Bill_.id), keyword); } }; }
From source file:th.co.geniustree.dental.spec.BillSpec.java
public static Specification<Bill> sumPriceLike(final Double keyword) { return new Specification<Bill>() { @Override//from www . j a v a 2s .com public Predicate toPredicate(Root<Bill> root, CriteriaQuery<?> cq, CriteriaBuilder cb) { return cb.equal(root.get(Bill_.sumPrice), keyword); } }; }
From source file:th.co.geniustree.dental.spec.TypeProductSpec.java
public static Specification<TypeProduct> nameLike(final String keyword) { return new Specification<TypeProduct>() { @Override//ww w . jav a2 s . c o m public Predicate toPredicate(Root<TypeProduct> root, CriteriaQuery<?> cq, CriteriaBuilder cb) { return cb.like(cb.upper(root.get(TypeProduct_.name)), keyword.toUpperCase()); } }; }
From source file:th.co.geniustree.dental.spec.UnitProductSpec.java
public static Specification<UnitProduct> nameLike(final String keyword) { return new Specification<UnitProduct>() { @Override/* w ww. j a v a 2 s . c om*/ public Predicate toPredicate(Root<UnitProduct> root, CriteriaQuery<?> cq, CriteriaBuilder cb) { return cb.like(cb.upper(root.get(UnitProduct_.name)), keyword.toUpperCase()); } }; }