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.dental.spec.PatientSpec.java

public static Specification<Patient> hmLike(final String keyword) {
    return new Specification<Patient>() {

        @Override//from w ww  .  ja  v  a 2 s .  c o  m
        public Predicate toPredicate(Root<Patient> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
            return cb.like(cb.upper(root.get(Patient_.hn)), keyword.toUpperCase());
        }
    };
}

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

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

        @Override/*from  w  w  w.ja  v  a2 s.c  o  m*/
        public Predicate toPredicate(Root<Patient> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
            return cb.like(cb.upper(root.get(Patient_.name)), keyword.toUpperCase());
        }
    };
}

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

public static Specification<Patient> emailLike(final String keyword) {
    return new Specification<Patient>() {

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

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

public static Specification<Patient> pidLike(final String keyword) {
    return new Specification<Patient>() {

        @Override/* w w w  .j a v a2  s  . c om*/
        public Predicate toPredicate(Root<Patient> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
            return cb.like(root.get(Patient_.pid), keyword);
        }
    };
}

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

public static Specification<Doctor> emailLike(final String keyword) {
    return new Specification<Doctor>() {

        @Override//www  .  j a  v  a2s.co m
        public Predicate toPredicate(Root<Doctor> root, CriteriaQuery<?> cq, CriteriaBuilder cb) {
            return cb.like(cb.upper(root.get(Doctor_.email)), keyword.toUpperCase());
        }
    };
}

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

public static Specification<Doctor> mobileLike(final String keyword) {
    return new Specification<Doctor>() {

        @Override// w ww . j a v a  2  s.c  o  m
        public Predicate toPredicate(Root<Doctor> root, CriteriaQuery<?> cq, CriteriaBuilder cb) {
            return cb.like(root.get(Doctor_.mobile), keyword);
        }
    };
}

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

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

        @Override//from w ww . j a  v  a 2s .c om
        public Predicate toPredicate(Root<Doctor> root, CriteriaQuery<?> cq, CriteriaBuilder cb) {
            return cb.or(cb.like(root.get(Doctor_.nameTh), keyword),
                    cb.like(cb.upper(root.get(Doctor_.nameEng)), keyword.toUpperCase()));
        }
    };
}

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

public static Specification<Staff> emailLike(final String keyword) {
    return new Specification<Staff>() {

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

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

public static Specification<Staff> mobileLike(final String keyword) {
    return new Specification<Staff>() {

        @Override/*from  w w w. java2  s .com*/
        public Predicate toPredicate(Root<Staff> root, CriteriaQuery<?> cq, CriteriaBuilder cb) {
            return cb.like(root.get(Staff_.mobile), keyword);
        }
    };
}

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

public static Specification<Staff> pidLike(final String keyword) {
    return new Specification<Staff>() {

        @Override//from  w  w w.j  a v  a2 s .  c o  m
        public Predicate toPredicate(Root<Staff> root, CriteriaQuery<?> cq, CriteriaBuilder cb) {
            return cb.like(root.get(Staff_.pid), keyword);
        }
    };
}