You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@empire-db.apache.org by ivan nemeth <iv...@forumdigital.net> on 2014/07/29 17:10:48 UTC
Constraints on the same column
Hi,
I tried to execute a query on a table which has a Date column. I want to
add the following constraint
TABLE.DATE >= ? AND TABLE.DATE <= ?
If I write
Date d0 = ...
Date d1 = ...
cmd.where(TABLE.DATE.isMoreOrEqual(d0));
cmd.where(TABLE.DATE.isLessOrEqual(d1));
then the first constraint is removed, and only the second is valid (I know
this is a between constraint).
The documentation of the DBCommand.where method says
<If another restriction already exists for the same column it will be
replaced.>
(However if I add the two constraint through the
DBCommand.addWhereConstraints method, it works.)
Why is the previous constraint on the same column removed, what is the
logic behind it? I think it's the developers responsibility not to make
mutually exclusive conditions. Or am I missing something?
Thanks,
Ivan