没有
NEW(选择标量值 和 集合值的路径表达式)的查询无效,因此我认为添加a
NEW不会使事情起作用。
作为记录,这是JPA 2.0规范在 4.8 SELECT子句中 所说的:
SELECT子句具有以下语法:
select_clause ::= SELECT [DISTINCT] select_item {, select_item}*select_item ::= select_expression [ [AS] result_variable]select_expression ::= single_valued_path_expression | scalar_expression | aggregate_expression | identification_variable | OBJECT(identification_variable) | constructor_expressionconstructor_expression ::= NEW constructor_name ( constructor_item {, constructor_item}* )constructor_item ::= single_valued_path_expression | scalar_expression | aggregate_expression | identification_variableaggregate_expression ::= { AVG | MAX | MIN | SUM } ([DISTINCT]state_field_path_expression) |
COUNT ([DISTINCT] identification_variable |
state_field_path_expression |
single_valued_object_path_expression)



