Example usage for javax.persistence.criteria Root get

List of usage examples for javax.persistence.criteria Root get

Introduction

In this page you can find the example usage for javax.persistence.criteria Root get.

Prototype

<Y> Path<Y> get(SingularAttribute<? super X, Y> attribute);

Source Link

Document

Create a path corresponding to the referenced single-valued attribute.

Usage

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

public static Specification<Doctor> idWhere(final Integer keyword) {
    return new Specification<Doctor>() {
        @Override/*  ww w  . j  a v  a2s.  c om*/
        public Predicate toPredicate(Root<Doctor> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
            return cb.equal(root.get(Employee_.id), keyword);
        }
    };
}

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

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

        @Override//from  www  .jav  a 2s.c  o  m
        public Predicate toPredicate(Root<Patient> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
            return cb.like(root.get(Patient_.pid), keyword);
        }
    };
}

From source file:edu.chalmers.dat076.moviefinder.persistence.SeriesSpecs.java

/**
 * //from  w  w  w.j a va2  s . c o m
 * @param releaseYear
 * @return All series first released the year releaseYear
 */
public static Specification<Series> hasReleaseYear(final int releaseYear) {
    return new Specification<Series>() {
        @Override
        public Predicate toPredicate(Root<Series> root, CriteriaQuery<?> cq, CriteriaBuilder cb) {
            return cb.equal(root.get(Series_.releaseYear), releaseYear);
        }
    };
}

From source file:edu.chalmers.dat076.moviefinder.persistence.EpisodeSpecs.java

/**
 * //www.  j  a  va  2s  . co m
 * @param releaseYear
 * @return All Episodes released the year releaseYear
 */
public static Specification<Episode> hasReleaseYear(final int releaseYear) {
    return new Specification<Episode>() {
        @Override
        public Predicate toPredicate(Root<Episode> root, CriteriaQuery<?> cq, CriteriaBuilder cb) {
            return cb.equal(root.get(Episode_.releaseYear), releaseYear);
        }
    };
}

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

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

        @Override//from   ww  w  .  j  a  v a2  s  .c o  m
        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> mobileLike(final String keyword) {
    return new Specification<Staff>() {

        @Override//from   ww w .  j av a  2s. c  o  m
        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/* w w  w  . j a  va2  s  . c  om*/
        public Predicate toPredicate(Root<Staff> root, CriteriaQuery<?> cq, CriteriaBuilder cb) {
            return cb.like(root.get(Staff_.pid), keyword);
        }
    };
}

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

public static Specification<Staff> idWhere(final Integer keyword) {
    return new Specification<Staff>() {
        @Override//w  w  w. j a v a2  s.com
        public Predicate toPredicate(Root<Staff> root, CriteriaQuery<?> cq, CriteriaBuilder cb) {
            return cb.equal(root.get(Staff_.id), keyword);
        }
    };
}

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

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

        @Override/*  w  ww.  ja  v  a 2  s .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.EmployeeSpec.java

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

        @Override//ww w . ja v  a 2 s . c  o m
        public Predicate toPredicate(Root<Employee> root, CriteriaQuery<?> cq, CriteriaBuilder cb) {
            CriteriaQuery cc = cq.orderBy(cb.desc(root.get(Employee_.id)));
            return cb.like(cb.upper(root.get(Employee_.email)), keyword.toUpperCase());
        }
    };
}