ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emiliano Armellin <earmel...@ateikon.com>
Subject Abator new Generator Set
Date Tue, 26 Sep 2006 10:40:26 GMT
Hello,

I have to add different *and* clauses in different place of my code, 0 
or more and clauses...

Which is the correct way to do it?

My solution is this:
|
            TableExample.Criteria criteria = example.createCriteria();

            if(StringUtils.isNotBlank(field1)){
                criteria.andField2EqualTo(field1);
            }
           
            if(StringUtils.isNotBlank(field2)){
                criteria.andField2EqualTo(field2);
            }|

this solution does not work if field1 & field2 are empty, it creates an 
empty clause  (   )

Why does not exist an example.and(criteria) method?


-- 
Emiliano Armellin

    *
      W_
      www.ateikon.com <http://www.ateikon.com>
    *
      @_
      earmellin@ateikon.com <mailto:earmellin@ateikon.com>
    *
      T_
      *+39 0422 452101*

Get Firefox! <http://www.spreadfirefox.com/?q=affiliates&id=15653&t=86>
Get Thunderbird <http://www.mozilla.org/products/thunderbird/>

Mime
View raw message