Jakob Braeuchi dijo:
> hi antonio,
>
> the parameter could be used to mark the whole criteria 'negative'. there
> would be no special addNot-method:
>
> Criteria crit1 = new Criteria();
> crit1.addEqualTo("field1","test1");
> crit1.addEqualTo("field2","test1");
> crit1.setNegative(true);


The point is: I can use after the above code:

crit1.setNegative(false);

Then:

where (field1=test1 and field2=test2)

Is this correct?

Best Regards,

Antonio Gallardo

>
> Criteria crit2 = new Criteria();
> crit2.addEqualTo("field3","test3");
> crit2.addEqualTo("field4","test4");
>
> crit1.addOr(crit2);
>
> result :
>
> select ... where NOT(field1=test1 and field2=test2) OR (field3=test3 AND
>   field4=test4)
>
> jakob
>
> Antonio Gallardo wrote:
>> Jakob Braeuchi dijo:
>>
>>>hi robert,
>>>
>>>what do you think about a 'NOT'-flag in the criteria ?
>>>
>>>Criteri crit = new Criteria();
>>>
>>>crit.addEqualTo("field1","test1");
>>>crit.addEqualTo("field2","test1");
>>>crit.setNegative(true);
>>
>>
>> [RT]
>>
>> Is important to have the parameter in setNegative()? I guess, this is
>> because we can turn it off later. Right?
>>
>> I think when we build a criteria we already know if it would negative or
>> not. In that case the parameter is not needed at all.
>>
>> But maybe, in some special situation, someone can need to reverse the
>> setNegative() effect in the criteria. In this case the param is needed.
>>
>> This are just random thoughts about this topic.
>>
>> Best Regards,
>>
>> Antonio Gallardo


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to