I'm working on CriteriaBuilder. If the record exists, it will correctly return a value. But I need the query to return a value, e.g. an empty string or "," if the record is not found. Currently, if it doesn't find the record, it returns nothing. It just jumps.
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder(); CriteriaQuery<Long> criteriaQuery = criteriaBuilder.createQuery(Long.class); Root<Stock> stock = criteriaQuery.from(Stock.class); criteriaQuery.select(stock.get(storage)) .where(stock.get(ITEM_NR).in(eans)); return entityManager.createQuery(criteriaQuery).getResultList();
So now is 1,2,4 instead r 1,2,,4
If 3 doesn't exist.
Please help.