SELECT FROM prop_property WHERE prop_property.ZON_ID=1 AND ((prop_property.AGE_ID>='1' AND prop_property.AGE_ID<=6) OR (prop_property.CIT_ID>=1 AND prop_property.CIT_ID<=9))
Criteria crit = new Criteria();
crit.add(PropPropertyPeer.ZON_ID,1);
Criteria.Criterion a1 = crit.getNewCriterion( PropPropertyPeer.AGE_ID,
(Object) (new Integer(1).toString()), Criteria.GREATER_EQUAL);
Criteria.Criterion a2 = crit.getNewCriterion( PropPropertyPeer.AGE_ID,
(Object)( new Integer(6)), Criteria.LESS_EQUAL);
Criteria.Criterion b1 = crit.getNewCriterion(
PropPropertyPeer.CIT_ID, (Object)(new Integer(1)), Criteria.GREATER_EQUAL);
Criteria.Criterion b2 = crit.getNewCriterion(
PropPropertyPeer.CIT_ID, (Object)(new Integer(9)), Criteria.LESS_EQUAL);
crit.add( a1.and(a2 ).or(b1.and(b2)));
With null, I use de Criteria.CUSTOM
Andrew Belonogov wrote:
Hello I need a criteria something like where (a.id=b.id or a.id is null)
--
------------------------
Felipe Ramos
Tissat SA
C/ Orense 34-9�
28020 Madrid
Tel: (+34) 91 4175913 Fax: (+34) 91 4172914
Mail: [EMAIL PROTECTED]
------------------------
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
