|
In Hibernate if a constructor expression is used, it must be the only select expression in the query. So select new a.b.Foo(p.name, p.city) from Person p is supported, but these are not:
-
select p.id, new a.b.Foo(p.name, p.city) from Person p
-
select new a.b.Foo(p.name, p.city), new a.b.Bar(p.age) from Person p
-
etc
However, these should be supported according to the official JPQL syntax: {{ select_clause ::= SELECT [DISTINCT] select_expression {, select_expression}
* select_expression ::= single_valued_path_expression | aggregate_expression | identification_variable | OBJECT(identification_variable) | constructor_expression constructor_expression ::= NEW constructor_name ( constructor_item {, constructor_item}
* ) }} See also https://hibernate.atlassian.net/browse/HHH-3082.
I am working on a Pull Request to support this.
|