Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CriteriaBuilder builder = sessionFactory.getCurrentSession().getCriteriaBuilder();
- CriteriaQuery<String> criteria = builder.createQuery(String.class);
- Root<EstimatedObject> root = criteria.from(EstimatedObject.class);
- criteria.select(root.get("customer")).distinct(true);
- Predicate predicate = builder.like(
- builder.lower(root.get("customer")),
- builder.lower(builder.literal("%" + like + "%"))
- );
- criteria.where(predicate);
- List<String> customerList = sessionFactory.getCurrentSession().createQuery(criteria).getResultList();
- customerList.forEach(System.out::println);
- Hibernate: select distinct estimatedo0_.customer as col_0_0_
- from directories_object.estimated_object estimatedo0_
- where lower(estimatedo0_.customer) like lower(?)
Add Comment
Please, Sign In to add comment