[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Criteria queries and collection valued properties

alexg79 do-not-reply at jboss.com
Mon Dec 17 04:43:19 EST 2007


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?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4113314#4113314

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4113314



More information about the jboss-user mailing list