db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Fischer <fisc...@seitenbau.net>
Subject RE: ISNULL with Criterion?
Date Wed, 10 Oct 2007 07:03:37 GMT
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" <bmiller@dotster.com> 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: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>


---------------------------------------------------------------------
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