Hi List!

I tried several hours now, to get a simple or to work... I must say, that i really would appreciate a bit of documentation on that.

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;


pretty simple. now, what i did is the following:

************************
**CODE
************************
// just for demonstration i replaced a String by "hello"
userKeyWord = "%hello%";

Criteria crit = new Criteria();
crit.add(MoviiUser.IS_DELETED,0);

Criteria.Criterion a1 = crit.getNewCriterion( MoviiUserPeer.LAST_NAME,
                                (Object) (userKeyWord), Criteria.LIKE);

Criteria.Criterion a2 = crit.getNewCriterion(MoviiUserPeer.FIRST_NAME,
                                (Object)userKeyWord, Criteria.LIKE);

Criteria.Criterion a3 = crit.getNewCriterion(MoviiUserPeer.LOGIN_NAME,
                                (Object) userKeyWord, Criteria.LIKE);

Criteria.Criterion a4 = crit.getNewCriterion(MoviiUserPeer.EMAIL,
                                (Object) userKeyWord,

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 though, but in my eyes pretty uncool;)

Would be cool, if someone could tell me, if this is realisable more easy...
TIA

Alex Hepp
--
bÃro fÃr design & informatik evamann gbr

alex hepp, dipl. informatiker (fh) | alkuinstr. 24 | d-54290 trier
tel.: 0651 991 61 03  |  mobil: 0170 342 02 24
e-mail: [EMAIL PROTECTED] | www.evamann.de

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

Reply via email to