3 Replies Latest reply on Sep 11, 2007 10:37 AM by Anton Anton

    Misunderstanding SqlResultSetMapping

    Anton Anton Newbie

      I'm trying to write nativeQuery which should returns result in 2 enitities:
      A & B. There are a lot of fields in each entity.
      @SqlResultSetMapping(name="BLABLABLA",
      entities={@EntityResult(entityClass=A.class,
      fields={@FieldResult(name="aid",
      column="aid")}
      ),
      @EntityResult(entityClass=B.class,
      fields={@FieldResult(name="bid",
      column="bid")}
      )})
      My questions are:
      should I put all fields in @FieldResult anotations, if I am interested in only in primary keys of 2 entities?
      If I want receive additional fields - Have I to add these fields to @FieldResult?
      And now I have trouble with my native query:
      Entity A have realtion with another entity C (type one2one, PK of another entity are saved in A table) and when query is executed - the Hibernate throws errors, that it cannot read the property C. What is the problem?