0 Replies Latest reply on Dec 17, 2007 4:42 AM by Alex Grönholm

    Criteria queries and collection valued properties

    Alex Grönholm Novice

      Suppose I have a Set of Integers as a collection valued property in an entity class, and I want to include it in the results (projection) of a criteria query, how do I do it? The Hibernate documentation only explains how to do it for associations.
      If I try to map it to an alias, I get a MappingException saying "collection was not an association: ...".
      Trying to add it directly as a projection with Projections.property() only gives me the root entity's ID for some reason.
      Regardless of whether I set the fetch mode for the collection property to JOIN or not, Hibernate refuses to fetch it in the query. Why is this happening?