Example usage for javax.persistence.criteria CriteriaBuilder like

List of usage examples for javax.persistence.criteria CriteriaBuilder like

Introduction

In this page you can find the example usage for javax.persistence.criteria CriteriaBuilder like.

Prototype

Predicate like(Expression<String> x, String pattern);

Source Link

Document

Create a predicate for testing whether the expression satisfies the given pattern.

Usage

From source file:th.co.geniustree.intenship.advisor.spec.TimetableSpec.java

public static Specification<Timetable> nameLike(final String keyword) {
    return new Specification() {
        @Override//from www .  j  a va 2s  .  c  om
        public Predicate toPredicate(Root root, CriteriaQuery cq, CriteriaBuilder cb) {
            return cb.like(cb.upper(root.get(Timetable_.account).get(Account_.name)), keyword.toUpperCase());
        }
    };
}

From source file:th.co.geniustree.intenship.advisor.spec.TimetableSpec.java

public static Specification<Timetable> nameTeacherLike(final String keyword) {
    return new Specification() {
        @Override/*from   www .  j  a v a 2  s . c  om*/
        public Predicate toPredicate(Root root, CriteriaQuery cq, CriteriaBuilder cb) {
            return cb.like(cb.upper(root.get(Timetable_.account).get(Account_.name)), keyword.toUpperCase());
        }
    };
}

From source file:carrental.repository.reservation.CarSpecification.java

public static Specification<Car> descriptionIsLike(final String description) {
    return new Specification<Car>() {
        @Override//from   w ww. j  a va  2s .c o  m
        public Predicate toPredicate(Root<Car> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder cb) {
            return cb.like(root.get("description"), description);
        }
    };
}

From source file:carrental.repository.reservation.CarSpecification.java

public static Specification<Car> colorIsLike(final String color) {
    return new Specification<Car>() {
        @Override/*  w  w w  .  j av  a 2  s .  co m*/
        public Predicate toPredicate(Root<Car> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder cb) {
            return cb.like(root.get("color"), color);
        }
    };
}

From source file:carrental.repository.reservation.CarSpecification.java

public static Specification<Car> licensePlateIs(final String licensePlate) {
    return new Specification<Car>() {
        @Override//from ww w  .  ja v  a  2 s.co  m
        public Predicate toPredicate(Root<Car> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder cb) {
            return cb.like(root.get("licensePlate"), licensePlate);
        }
    };
}

From source file:th.co.geniustree.intenship.advisor.spec.TimetableSpec.java

public static Specification<Timetable> nameParent(final String keyword) {
    return new Specification() {
        @Override//from w w  w  . j  a v  a  2 s . co  m
        public Predicate toPredicate(Root root, CriteriaQuery cq, CriteriaBuilder cb) {
            return cb.like(cb.upper(root.get(Timetable_.account).get(Student_.parent).get(Parent_.name)),
                    keyword.toUpperCase());
        }
    };
}

From source file:th.co.geniustree.dental.spec.LotSpec.java

public static Specification<Lot> nameStaffReamLike(final String keyword) {
    return new Specification<Lot>() {

        @Override/*w  ww  .  j a  v  a 2  s  .co  m*/
        public Predicate toPredicate(Root<Lot> root, CriteriaQuery<?> cq, CriteriaBuilder cb) {
            return cb.like(cb.upper(root.get(Lot_.nameStaffReam)), keyword.toUpperCase());
        }
    };
}

From source file:th.co.geniustree.dental.spec.ProductSpec.java

public static Specification<Product> nameLike(final String keyword) {
    return new Specification<Product>() {

        @Override/*from  www  .ja v a  2 s  .  c o m*/
        public Predicate toPredicate(Root<Product> root, CriteriaQuery<?> cq, CriteriaBuilder cb) {
            return cb.like(cb.upper(root.get(Product_.name)), keyword.toUpperCase());
        }
    };
}

From source file:th.co.geniustree.dental.spec.ProductSpec.java

public static Specification<Product> unitLike(final String keyword) {
    return new Specification<Product>() {

        @Override/*from  www .  j a  v  a  2  s .com*/
        public Predicate toPredicate(Root<Product> root, CriteriaQuery<?> cq, CriteriaBuilder cb) {
            return cb.like(cb.upper(root.get(Product_.unit).get(UnitProduct_.name)), keyword.toUpperCase());
        }
    };
}

From source file:th.co.geniustree.dental.spec.ProductSpec.java

public static Specification<Product> typeProductLike(final String keyword) {
    return new Specification<Product>() {

        @Override/* w  ww  .  ja v  a  2 s . co m*/
        public Predicate toPredicate(Root<Product> root, CriteriaQuery<?> cq, CriteriaBuilder cb) {
            return cb.like(cb.upper(root.get(Product_.typeProduct).get(TypeProduct_.name)),
                    keyword.toUpperCase());
        }
    };
}