-->
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: Group By Nested Entity
PostPosted: Tue Aug 13, 2013 11:01 pm 
Newbie

Joined: Sun Aug 11, 2013 5:14 am
Posts: 2
Hi,
I am facing issues using nested entity with a Group By clause. I have entity Parent with child entity nested inside it and a sub child entity inside Child. I am using groupby child.subChild to retrive Parent data. But after transformation, Parent Object comes with null Child Object. Please Help

Criteria criteria = createCriteria(Parent.class)
.createAlias("Child", "ch")
.createAlias("ch.subCH", "subCH");
ProjectionList projList = Projections.projectionList();
projList.add(Projections.alias(Projections.groupProperty("ch.subCH"),"subCH"));*/
projList.add(Projections.alias(Projections.count("pKParentID"),"ID"));
projList.add(Projections.alias(Projections.groupProperty("ParentName"),"ParentName"));
criteria.setProjection(projList);
criteria.setResultTransformer(Transformers.aliasToBean(Parent.class));
criteria.list();

Parent.Child comes as null


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.