ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Iwao AVE!" <haraw...@gmail.com>
Subject Null handling of Ibator's Criteria class.
Date Tue, 21 Apr 2009 10:09:37 GMT
Hi all,

A Criteria inner class generated by Ibator throws RuntimeException when
addCriterion() or addCriterionForJDBCDate() method is called with null
as its 'value' argument.
As a result of this behavior, when I build a dynamic criteria, I have to
check null for each condition.

Criteria criteria = someExample.createCriteria();
if (condition1 != null)
  criteria.andCondition1EqualTo(condition1);
if (condition2 != null)
  criteria.andCondition1EqualTo(condition2);
...

Basically, I want criteria classes to ignore null value (i.e. not to add
any criteria).
When some condition is required, I would validate it in another way
(presentation framework's validation feature, for example).

Before opening a new issue on JIRA, I would like to hear from other
Ibator users about the behavior.
What do you think?

Thanks,
Iwao

Mime
View raw message