-->
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.  [ 3 posts ] 
Author Message
 Post subject: Aggregation query
PostPosted: Tue Dec 19, 2017 7:33 am 
Newbie

Joined: Tue Dec 19, 2017 7:23 am
Posts: 2
Hi, I might have made a stupid question but I really can not figure out. In the find queries you expect an entity object or a list of entity objects.
However when you perform a aggregate query with hibernate what is supposed to be expected as a result. In mongo the documents that come from an aggregate and
group query are not similar with the documents before the query.


Top
 Profile  
 
 Post subject: Re: Aggregation query
PostPosted: Thu Dec 21, 2017 8:12 am 
Hibernate Team
Hibernate Team

Joined: Thu Jan 05, 2017 6:04 am
Posts: 13
Sorry for the late answer.

You have 2 cases, either your aggregate ends up returning entities and OGM can extract the entities for you (see the addEntity() call):
https://github.com/hibernate/hibernate- ... .java#L669

Or it doesn't return entities and you end up with results directly coming from MongoDB:
https://github.com/hibernate/hibernate- ... .java#L790


Top
 Profile  
 
 Post subject: Re: Aggregation query
PostPosted: Mon Dec 25, 2017 3:10 pm 
Newbie

Joined: Tue Dec 19, 2017 7:23 am
Posts: 2
Thanks a lot for your answer. My query belongs definitely in the second category so I would expect a mongo db object. However, If in the aggregation query we use projection to return so that the query results contain all the properties that map to the entity's properties, would hibernate succeed to map it the entity object?


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

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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.