this is how I hacked it... works now...
keyword = "%" + keyword + "%";
Criteria crit = new Criteria();
Criteria.Criterion criterion = null;
criterion = crit.getNewCriterion(FIRST_NAME, (Object)keyword, Criteria.LIKE)
.or(crit.getNewCriterion(LAST_NAME, (Object)keyword,
Criteria.LIKE))
.or(crit.getNewCriterion(MIDDLE_I, (Object)keyword,
Criteria.LIKE));
crit.and(criterion);
----- Original Message -----
From: "Dan Bachelder" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, October 28, 2001 5:23 PM
Subject: Criteria and where clause
> a criteria created like this:
>
> crit = crit.or(LAST_NAME, (Object)keyword, Criteria.LIKE)
> .or(FIRST_NAME, (Object)keyword, Criteria.LIKE)
> .or(MIDDLE_I, (Object)keyword, Criteria.LIKE);
>
> and keyword.equals("a") gives me the following where clause....
>
> WHERE (CONTACT.LAST_NAME = 'a') AND (CONTACT.MIDDLE_I = 'a') AND
> (CONTACT.FIRST_NAME = 'a')
>
> what I want to see is:
>
> WHERE (CONTACT.LAST_NAME LIKE '%a%') OR (CONTACT.MIDDLE_I LIKE '%a%') OR
> (CONTACT.FIRST_NAME LIKE '%a%')
>
> I assumed Criteria.or() use the OR logical operator instead of the AND...
I
> also assumed Criteria.LIKE would use the LIKE operator... where have I
gone
> wrong?
>
> thanks,
> dan
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]