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.AppointmentSpec.java

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

        @Override//from  w  w w.  ja  v a2s. co  m
        public Predicate toPredicate(Root<Appointment> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
            return cb.like(root.get(Appointment_.patient).get(Patient_.name), keyword);
        }
    };
}

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

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

        @Override/*from w w w .  ja v  a 2  s  .  co m*/
        public Predicate toPredicate(Root<Appointment> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
            return cb.like(root.get(Appointment_.mobile), keyword);
        }
    };
}

From source file:edu.pitt.dbmi.ccd.db.specification.GroupSpecification.java

private static Predicate nameContains(Root<Group> root, CriteriaBuilder cb, String term) {
    return cb.like(cb.lower(root.get(NAME)), term);
}

From source file:edu.pitt.dbmi.ccd.db.specification.GroupSpecification.java

private static Predicate descriptionContains(Root<Group> root, CriteriaBuilder cb, String term) {
    return cb.like(cb.lower(root.get(DESC)), term);
}

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

public static Specification<Appointment> appointmentDate(final Date keyword) {
    return new Specification<Appointment>() {

        @Override/* w  w  w .j a  v  a2s .c  o m*/
        public Predicate toPredicate(Root<Appointment> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
            return cb.between(root.get(Appointment_.appointDay), keyword, keyword);
        }
    };
}

From source file:org.ngrinder.perftest.repository.TagSpecification.java

/**
 * Get the {@link Specification} which checks if the {@link Tag#getTagValue()} has one of given value.
 *
 * @param values tag lists/*from   w  w w  .  j a va2  s  . c  om*/
 * @return {@link Specification}
 */
public static Specification<Tag> valueIn(final String[] values) {
    return new Specification<Tag>() {
        @Override
        public Predicate toPredicate(Root<Tag> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
            return root.get("tagValue").in((Object[]) values);
        }
    };
}

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

/**
 * //from w w  w  .  j a  va  2s .c o m
 * @param imdbRating
 * @return returns all movies with a rating equal to or above imdbRating.
 */
public static Specification<Movie> hasImdbRatingAbove(final double imdbRating) {
    return new Specification<Movie>() {
        @Override
        public Predicate toPredicate(Root<Movie> root, CriteriaQuery<?> cq, CriteriaBuilder cb) {
            return cb.greaterThanOrEqualTo(root.get(Movie_.imdbRating), imdbRating);
        }
    };
}

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

/**
 * /*  ww w.  java2  s  .  c  o m*/
 * @param runtime
 * @return All movies with an runtime equal to or above runtime.
 */
public static Specification<Movie> hasRuntimeAbove(final int runtime) {
    return new Specification<Movie>() {
        @Override
        public Predicate toPredicate(Root<Movie> root, CriteriaQuery<?> cq, CriteriaBuilder cb) {
            return cb.greaterThanOrEqualTo(root.get(Movie_.runtime), runtime);
        }
    };
}

From source file:edu.pitt.dbmi.ccd.db.specification.VocabularySpecification.java

private static Predicate nameContains(Root<Vocabulary> root, CriteriaBuilder cb, String term) {
    return cb.like(cb.lower(root.get(NAME)), term);
}

From source file:edu.pitt.dbmi.ccd.db.specification.VocabularySpecification.java

private static Predicate descriptionContains(Root<Vocabulary> root, CriteriaBuilder cb, String term) {
    return cb.like(cb.lower(root.get(DESC)), term);
}