-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Criteria Query returning duplicate results in child list
PostPosted: Wed Jan 21, 2009 2:51 pm 
Newbie

Joined: Wed Jan 21, 2009 2:42 pm
Posts: 1
Hibernate version: 3.3.1

Hi, we have an object structure that looks like this:

ProdTypes have multiple attributes (List)

Attributes have multiple AttributeValues (List)

We are creating a criteria query like this:

crit.add(Restrictions.eq("prodTypeId", id))
.setFetchMode("attributes", FetchMode.JOIN)
.setFetchMode("attributes.attributeValues", FetchMode.JOIN)
.setFetchMode("attributes.xmlTags", FetchMode.JOIN)
.createCriteria("attributes", Criteria.LEFT_JOIN).add(Restrictions.isNotNull("attributeValues"))
.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);

We are getting back the correct number of ProductTypes, but the Attribute List has many duplicate records. Is there are way to put the Distinct Root Entity option on the Attribute object as well as the ProdType object?

Thanks,
Chris


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.