Just a shot into the dark:

Criterion c1 = crit.getNewCriterion(b, null, Criteria.ISNULL);

does not work ? (probably you have to cast the null)

    Thomas

"Brendan Miller" <[EMAIL PROTECTED]> schrieb am 09.10.2007 19:05:22:

>
> There doesn't seem to be a getNewCriterion(String column, SqlEnum
comparison)
>
> What do I do if I need something like
>
>     select ...
>      where a < 1 and a > 0 and
>       (b is null or (b not like 'abc%' and b not like 'xyz%')
>
> ?
>
> I was planning on
>
> Criteria crit = new Criteria();
> crit.add(a, 1, Criteria.LESS_THAN);
> crit.add(a, 0, Criteria.GREATER_THAN);
> Criterion c1 = crit.getNewCriterion(b, Criteria.ISNULL);  // no such
method
> Criterion c2 = crit.getNewCriterion(b, (Object) "abc%",
Criteria.NOT_LIKE);
> Criterion c3 = crit.getNewCriterion(b, (Object) "xyz%",
Criteria.NOT_LIKE);
> crit.and(c1.or(c2.and(c3)));
>
> This does not work with the ISNULL as part of the criterion.  Is this a
> case where I have to resort to a CUSTOM expression of
>
>     b, (Object) "b is null", Criteria.CUSTOM
>
> ?
>
> Thanks,
> Brendan
>
>
>
> ---------------------------------------------------------------------
> 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]

Reply via email to