-->
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: Querying on the result of a query
PostPosted: Thu May 26, 2016 9:45 am 
Newbie

Joined: Thu May 19, 2016 6:33 pm
Posts: 4
So I have items that have different properties: tags(many to many), user feedback(many to many), price etc. and I'm trying to build the queries for filtering the results based on those properties.

Filtering on those properties doesn't seem to be a problem, I can just use joins and predicates.

The real problem is when I try to get aggregate data based on that query. Let's say I want to count how many of the current results also have a certain tag associated with it. I can't/don't know how to make a selection on the objects that a join is associating, it says it needs a root. I tried to add a new root in my original query but I don't know how to link it with my other root/roots.

Example of what I want. Db has two tables, items (that are toys) and tags (plushy, can speak).
Step 1: You're not shown any result, but you're shown the tags and how many items are associated with those tags.
Step 2: You select plushy tag and the result is returned, "can speak" tag will now return a different number of how many items are associated with that tag, because it takes into consideration only the items that are returned in the current result.

How do I do this?


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.