In the IDE there are no errors for this code:
CriteriaBuilder criteriaBuilder = infoPersonAddressDAO.getEntityManager().getCriteriaBuilder();
CriteriaQuery<Date> criteriaQuery = criteriaBuilder.createQuery(Date.class);
Root<InfoPersonAddress> root = criteriaQuery.from(InfoPersonAddress.class);
criteriaQuery.select(criteriaBuilder.least(root.get(InfoPersonAddress.FIELD_NAME_CREATED_WHEN)));
TypedQuery<Date> queryData = infoPersonAddressDAO.getEntityManager().createQuery(criteriaQuery);
result = queryData.getSingleResult();
During Maven build with OpenJDK 17.0.5 on MacOS/ARM, I get this:
[e[1;31mERRORe[m] /Users/acm/dev/projects/Java/logipath/pirt/pirt-ejb/src/main/java/com/logipath/pirt/helper/info/person/address/InfoPersonAddressDTODAOImpl.java:[122,61] method least in interface jakarta.persistence.criteria.CriteriaBuilder cannot be applied to given types;
[e[1;31mERRORe[m] required: jakarta.persistence.criteria.Expression<X>
[e[1;31mERRORe[m] found: jakarta.persistence.criteria.Path<java.lang.Object>
[e[1;31mERRORe[m] reason: inferred type does not conform to equality constraint(s)