> > What would it take to add OR support for Criteria? Is
> > this an inherent limitation in the Criteria class design?
> > If anybody can give me pointers, I could try a stab at this.
>
> First of all you can fall back to CUSTOM (Not sure how that works).
>
> But good support for ORs etc. can be easily added.
>
> It can be added in the following way:
>
> 1. add a property to Criteria (not sure about the name, I'll call it
> Operator in the example) which would regulate whether all the conditions in
> the object are ORed or ANDed (AND should be default and it will be identical
> to the current behavior).
> 2. add method
>
> public Criteria add(Criteria subCriteria);
>
> to Criteria object which adds a Criteria object as a sub-criteria.
>
>
> So for your case you'll construct Criteria as follows:
>
> Criteria crit = new Criteria()
> .add(new Criteria()
> .add(xPeer.c1,"A",Criteria.LESS_THAN)
> .add(xPeer.c2,"B",Criteria.MORE_THAN)
> .setOperator(Criteria.OR))
> .add(new Criteria()
> .add(xPeer.c3,"C",Criteria.LESS_THAN)
> .add(xPeer.c4,"D",Criteria.MORE_THAN)
> .setOperator(Criteria.OR))
> .add(new Criteria()
> .add(xPeer.c5,"E",Criteria.LESS_THAN)
> .add(xPeer.c6,"F",Criteria.MORE_THAN)
> .setOperator(Criteria.OR))
>
I need OR support in my app, so I'm gonna take a stab at implementing this. If
anybody's worked/-ing on this, please stop me now. ;-)
>
> fedor.
>
--
Christopher Elkins
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]