Can I combine two or more finder functions with AND or OR operator to get one result collection?

Alex Chaffee

You'd have to do that sort of thing on the client side. Naturally, since find* methods can return many different types of Java objects, you'd have to write custom code based on the signature of the particular methods you used. Easiest would be if your find methods returned java.util.Set or java.util.List; you could then addAll() them both to a java.util.Set for OR, and write a simple loop for AND, like

List result1 = bean.findBySomething();
List result2 = bean.findBySomethingElse();
Set resultAnd = new HashSet();
for (Iterator i = result1.iterator(); i.hasNext(); ) {
  Object x = i.next();
  if (result2.contains(x)) {