db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From T E Schmitz <mail...@numerixtechnology.de>
Subject Re: is this really the way to combine several or´s ?
Date Wed, 22 Dec 2004 22:33:02 GMT
Hallo Alex,

Alex Hepp wrote:
> what i want now is this:
> SELECT * FROM movii_user where (FIRST_NAME LIKE "%hello%" or LAST_NAME 
> LIKE "%hello%" OR EMAIL LIKE "%hello%" or LOGIN_NAME="%hello%") AND 
> IS_DELETED=0;
> 
> ************************
> **CODE
> ************************
> Criteria crit = new Criteria();
> crit.add(MoviiUser.IS_DELETED,0);
> 
>                 [...]
> 
> Criteria.crit.add( a1.or( a2.or(a3.or(a4)) ));
> ************************
> **CODE END
> ************************
> 
> is this really the right way, or am i completely wrong? It´s working 

This is exactly it. Particularly when using the same column in more than 
one condition you *have to* use Criterions and "or" or "and" them 
together. Criteria is based on a HashMap with the column name as the 
key. If you Criteria.add'ed a column condition it would overwrite the 
previously added condition (for the same column).

-- 

Regards/Gruß,

Tarlika Elisabeth Schmitz

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message