0

これがJPQL例外をスローする理由を誰か説明できますか?

Query q = em.createQuery("select object(o) from SiteMember as o order by size(o.memberThread) desc");

memberThread refer a list.
4

1 に答える 1

0

おそらく、そのようなクエリのベンダー拡張を持たない JPA 実装 (データベースベンダーも問題になる可能性があります) を使用しているためです。JPA 2.0によると、次のタイプの値を in で使用できますORDER BY

 1.A state_field_path_expression that evaluates to an orderable state field of an 
   entity or embeddable class abstract schema type designated in the SELECT clause 
   by one of the following:  
 • a general_identification_variable  
 • a single_valued_object_path_expression  

 2.A state_field_path_expression that evaluates to the same state field of the same 
  entity or embeddable abstract schema type as a state_field_path_expression in the
  SELECT clause

3.A result_variable that refers to an orderable item in the SELECT clause for which 
 the same result_variable has been specified. This may be the result of an
 aggregate_expression, a  scalar_expression, or a state_field_path_expression in the 
 SELECT clause.

たとえば、クエリは EclipseLink(2.3.2) と MySQL で機能します。

于 2012-07-09T07:28:48.810 に答える