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(?)
Запускаю его на postgres - работает.
Через приложение, не хочет - возвращает 0 результатов.
Почему? Как это можно исправить?
Апостиль в Лос-Анджелесе без лишних нервов и бумажной волокиты
Основные этапы разработки сайта для стоматологической клиники
Продвижение своими сайтами как стратегия роста и независимости