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:carrental.repository.reservation.CarSpecification.java

public static Specification<Car> powerIsGreaterThanOrEqual(final Integer minPower) {
    return new Specification<Car>() {
        @Override/* ww  w  .  j  a v  a2s . c  om*/
        public Predicate toPredicate(Root<Car> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder cb) {
            return cb.greaterThanOrEqualTo(root.get("power"), minPower);
        }
    };
}

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

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

        @Override/* w  w  w.  j  a  v  a2 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  ww.ja v  a 2  s .c om*/
        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//from w  ww .j a va  2 s  .  c  o  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.StaffSpec.java

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

        @Override//from   w w  w .  j av a2 s.co m
        public Predicate toPredicate(Root<Staff> root, CriteriaQuery<?> cq, CriteriaBuilder cb) {
            return cb.or(cb.like(root.get(Staff_.nameTh), keyword),
                    cb.like(cb.upper(root.get(Staff_.nameEng)), keyword.toUpperCase()));
        }
    };
}

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

/**
 * //from   www. ja  v  a2 s .com
 * @param releaseYear
 * @return All movies with the release year releaseYear.
 */
public static Specification<Movie> hasReleaseYear(final int releaseYear) {
    return new Specification<Movie>() {
        @Override
        public Predicate toPredicate(Root<Movie> root, CriteriaQuery<?> cq, CriteriaBuilder cb) {
            return cb.equal(root.get(Movie_.releaseYear), releaseYear);
        }
    };
}

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

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

        @Override/*from   w w w . j  av  a2s  . c o  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:edu.chalmers.dat076.moviefinder.persistence.SeriesSpecs.java

/**
 * //  w ww. java  2  s  . c om
 * @param imdbRating
 * @return All Series with a rating equal to or above imdbRating
 */
public static Specification<Series> hasImdbRatingAbove(final double imdbRating) {
    return new Specification<Series>() {
        @Override
        public Predicate toPredicate(Root<Series> root, CriteriaQuery<?> cq, CriteriaBuilder cb) {
            return cb.greaterThanOrEqualTo(root.get(Series_.imdbRating), imdbRating);
        }
    };
}

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

public static Specification<Appointment> appointmentStatus(final String keyword) {
    return new Specification<Appointment>() {

        @Override//  w  w  w. jav a  2 s . c o m
        public Predicate toPredicate(Root<Appointment> root, CriteriaQuery<?> cq, CriteriaBuilder cb) {
            return cb.like(root.get(Appointment_.status), keyword);
        }
    };
}

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

/**
 * /*from   www.jav  a2 s.  c o m*/
 * @param imdbRating
 * @return All Episodes with a rating equal to or above imdbRating
 */
public static Specification<Episode> hasImdbRatingAbove(final double imdbRating) {
    return new Specification<Episode>() {
        @Override
        public Predicate toPredicate(Root<Episode> root, CriteriaQuery<?> cq, CriteriaBuilder cb) {
            return cb.greaterThanOrEqualTo(root.get(Episode_.imdbRating), imdbRating);
        }
    };
}