db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brendan Miller" <bmil...@dotster.com>
Subject ISNULL with Criterion?
Date Tue, 09 Oct 2007 17:05:22 GMT

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


Mime
View raw message