The problem is the same, the only difference is that the query gets constructed via criteria api. The root of all the problems is that treat isn't fully supported and probably won't be until Hibernate 6 as far as I understood.