Hello,
I am writing a Java application which fires multiple SQL queries and builds a data structure. All the attributes of data structure can not be fetched in single query. So I have to fire multiple queries and then combine all resultsets to get data for attributes.
To achieve this, I am planning to keep a View object having all the attributes. I will populate this VO and add it in the collection.
But I also have to filter the collection based on user defined filters (for ex: all employees whose name starts with 'A'). These filters can be set on any of the attribute.
Is there any efficient way of doing this? Any suggestions? What type of collection I should use? How can I filter collection objects?
- Ani
-
Populate and filter objects from Java collection (2 messages)
- Posted by: anirudha joshi
- Posted on: April 10 2005 22:03 EDT
Threaded Messages (2)
- Populate and filter objects from Java collection by Christopher Stehno on April 11 2005 11:07 EDT
- Populate and filter objects from Java collection by Rich Hill on April 11 2005 17:18 EDT
-
Populate and filter objects from Java collection[ Go to top ]
- Posted by: Christopher Stehno
- Posted on: April 11 2005 11:07 EDT
- in response to anirudha joshi
You should look into the Jakarta Commons Collections API (http://jakarta.apache.org/commons/collections) -
Populate and filter objects from Java collection[ Go to top ]
- Posted by: Rich Hill
- Posted on: April 11 2005 17:18 EDT
- in response to anirudha joshi
This is one of those situations where developing with Hibernate would really pay off. Assuming that you didn't, I'd suggest applying the filter to the query string and let DB do the sorting and filtering for you. Then just run down your result set in order. Why make your life harder.