Package javax.persistence.criteria

Examples of javax.persistence.criteria.CriteriaBuilder.upper()


    cq.where( cb.equal( cb.lower( root.get( Client_.name ).get( Name_.lastName ) ),"test" ) );
    em.createQuery( cq ).getResultList();
    // upper
    cq = cb.createQuery( Client.class );
    root = cq.from( Client.class );
    cq.where( cb.equal( cb.upper( root.get( Client_.name ).get( Name_.lastName ) ),"test" ) );
    em.createQuery( cq ).getResultList();
    em.getTransaction().commit();
    em.close();
  }
}
View Full Code Here


        CriteriaQuery<Book> query = builder.createQuery(Book.class);
        Root<Book> book = query.from(Book.class);
        List<Predicate> predicates = new ArrayList<Predicate>();
        if (StringUtils.hasText(bookSearchCriteria.getTitle())) {
            String title = bookSearchCriteria.getTitle().toUpperCase();
            predicates.add(builder.like(builder.upper(book.<String> get("title")), "%" + title + "%"));
        }

        if (bookSearchCriteria.getCategory() != null) {
            Category category = this.entityManager.find(Category.class, bookSearchCriteria.getCategory().getId());
            predicates.add(builder.equal(book.<Category> get("category"), category));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.