-->
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: Filtering objects by comparing collections...
PostPosted: Thu Oct 04, 2007 3:24 pm 
Newbie

Joined: Wed Jun 15, 2005 12:22 pm
Posts: 7
Hello all,

I'm investigating how I could reasonably compare a collection on a series of objects to an incoming collection for the sake of filtering. In an old school manner I could loop a collection and compare the collection on each object to the incoming collection. This would result in a collection of objects where each object has it's own collection which meets the requirements provided by the incoming collection.

There would also be another parameter (an enum) provided alongside the incoming collection. This enum would be something like exact, any, and all. 'Exact' would mean that the objects in my resulting collection should have their own collection that equals the collection being passed in (with no more or no less objects). 'Any' would mean that at least one of the objects in my incoming collection is contained in the collection for each object in my results. 'All' would mean that each object in my resulting collection would have it's own collection that contains all of the items in the incoming collection (and possibly more).

I'm using this to apply filtering to a simple collection of objects that are maintained by nhibernate. I thought about writing an HQL query that included the IN clause and took a collection of Ids that represent my incoming collection. This seems to be fine, however, it doesn't address each of the previously mentioned three scenarios (exact, any, and all).

I'm still in investigation mode, but if anyone has any input it would be highly appreciated.

Corey


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.