1 Reply Latest reply on Sep 19, 2007 7:22 AM by Carlo de Wolf

    Ordering on Transient Field

    Fabrizio Boco Newbie


      I have the following Entity Bean

      public class E1 implements Serializable
       private String p1;
       public Double getP2()

      If I executes the following query:
       select o from E1 as o order by o.p2

      I obviously get the following error:
      org.hibernate.QueryException: could not resolve property: p2

      Question is if I can use transient fields in EJBQL queries and how.

      Thank you


        • 1. Re: Ordering on Transient Field
          Carlo de Wolf Master


          "Java Persistence API, 4.3" wrote:
          For every persistent field or get accessor method (for a persistent property) of the entity class, there is a field (''state-field'') whose abstract schema type corresponds to that of the field or the result type of the accessor method.

          "JPA, 4.9" wrote:
          orderby_clause ::= ORDER BY orderby_item {, orderby_item}*
          orderby_item ::= state_field_path_expression [ASC | DESC]

          "JPA, 2.1.1" wrote:
          All non-transient instance variables that are not annotated with the Transient annotation are persistent.

          Take make a long story short: no.