I think it is a bug exposed. Btw, there is a good article on related topic here: https://vladmihalcea.com/how-does-hibernate-handle-jpa-criteria-api-literals/