When I use criteria api and e.g. try to do equal against path expression and Integer number I got query that renders to e.g where val = 1, instead of val = ?
This affects performance, because disallow to use prepared statements cache.
This behaviour occurs only for some types, e.g. dates uses prepared statements params.
This is not a bug. If you want to use a parameter, then define a parameter via the CriteriaBuilder