List of usage examples for javax.persistence.criteria CriteriaBuilder upper
Expression<String> upper(Expression<String> x);
From source file:th.co.geniustree.dental.spec.DetailHealSpec.java
public static Specification<DetailHeal> patientLike(final String keyword) { return new Specification<DetailHeal>() { @Override/*from w ww . jav a 2s . com*/ public Predicate toPredicate(Root<DetailHeal> root, CriteriaQuery<?> cq, CriteriaBuilder cb) { return cb.like(cb.upper(root.get(DetailHeal_.patient).get(Patient_.name)), keyword); } }; }
From source file:th.co.geniustree.dental.spec.DetailHealSpec.java
public static Specification<DetailHeal> doctorLike(final String keyword) { return new Specification<DetailHeal>() { @Override//www .j a va2 s .co m public Predicate toPredicate(Root<DetailHeal> root, CriteriaQuery<?> cq, CriteriaBuilder cb) { return cb.like(cb.upper(root.get(DetailHeal_.doctor).get(Doctor_.nameTh)), keyword); } }; }
From source file:th.co.geniustree.dental.spec.PriceAndExpireProductSpec.java
public static Specification<PriceAndExpireProduct> productLike(final String keyword) { return new Specification<PriceAndExpireProduct>() { @Override//from ww w . java 2s . com public Predicate toPredicate(Root<PriceAndExpireProduct> root, CriteriaQuery<?> cq, CriteriaBuilder cb) { return cb.and(cb.like(cb.upper(root.get(PriceAndExpireProduct_.product).get(Product_.name)), keyword.toUpperCase()), cb.isNull(root.get(PriceAndExpireProduct_.status))); } }; }
From source file:th.co.geniustree.dental.spec.DetailHealSpec.java
public static Specification<DetailHeal> patientLikeForBill(final String keyword) { return new Specification<DetailHeal>() { @Override// w w w .j a v a 2 s. c om public Predicate toPredicate(Root<DetailHeal> root, CriteriaQuery<?> cq, CriteriaBuilder cb) { return cb.and(cb.like(cb.upper(root.get(DetailHeal_.patient).get(Patient_.name)), keyword), cb.isNull(root.get(DetailHeal_.status))); } }; }
From source file:th.co.geniustree.dental.spec.DetailHealSpec.java
public static Specification<DetailHeal> doctorLikeForBill(final String keyword) { return new Specification<DetailHeal>() { @Override//from ww w. j a va 2 s . com public Predicate toPredicate(Root<DetailHeal> root, CriteriaQuery<?> cq, CriteriaBuilder cb) { return cb.and(cb.like(cb.upper(root.get(DetailHeal_.doctor).get(Doctor_.nameTh)), keyword), cb.isNull(root.get(DetailHeal_.status))); } }; }
From source file:th.co.geniustree.dental.spec.AppointmentSpec.java
public static Specification<Appointment> nameDoctorLike(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<?> query, CriteriaBuilder cb) { return cb.or( cb.like(cb.upper(root.get(Appointment_.doctor).get(Doctor_.nameEng)), keyword.toUpperCase()), cb.like(root.get(Appointment_.doctor).get(Doctor_.nameTh), keyword)); } }; }
From source file:th.co.geniustree.dental.spec.EmployeeSpec.java
public static Specification<Employee> emailLike(final String keyword) { return new Specification<Employee>() { @Override/*from w w w . j a va2s . com*/ 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()); } }; }
From source file:th.co.geniustree.dental.spec.DoctorSpec.java
public static Specification<Doctor> nameLike(final String keyword) { return new Specification<Doctor>() { @Override/* w w w. java 2s. 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> nameLike(final String keyword) { return new Specification<Staff>() { @Override//from w w w . j a va 2s . com 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:com.ocs.dynamo.dao.query.JpaQueryBuilder.java
/** * Creates a query used to retrieve a single entity based on a unique property value * // w w w . j av a2s .co m * @param entityManager * @param entityClass * @param propertyName * @param value * @return */ public static <T> CriteriaQuery<T> createUniquePropertyQuery(EntityManager entityManager, Class<T> entityClass, String propertyName, Object value, boolean caseSensitive) { CriteriaBuilder builder = entityManager.getCriteriaBuilder(); CriteriaQuery<T> cq = builder.createQuery(entityClass); Root<T> root = cq.from(entityClass); Predicate equals = null; if (value instanceof String && !caseSensitive) { equals = builder.equal(builder.upper(root.get(propertyName).as(String.class)), ((String) value).toUpperCase()); } else { equals = builder.equal(root.get(propertyName), value); } cq.where(equals); return cq; }