I have this query:
em.createQuery("select new SomeDto(some.name, " +
"(select max(other.weight) from Other other where other.someId = some.id) as otherWeight" +
") from Some some order by otherWeight")
.getResultList();
Which does not work because hibernate ignores the as otherWeight
and simply generates as col_1_0_
instead.
Is there any way with this kind of select new dto
query to get aliases for columns?
If not: how can i do such a query (map result of query to DTO constructor)?