Hi,

another issue with constraints.

you can't add two constraint on the same column with
DBCommand.where(DBCommandExpr expr) method. The documentation says

"If another restriction already exists for the same column it will be
replaced."

So if I want to query persons who's name starts with "A" but is not "Adam",
I can do the following:

cmd.select(TABLE.getColumns());
cmd.where(TABLE.NAME.like("A%"));
cmd.where(TABLE.NAME.isNot("Adam"));

Due to the above mentioned restriction this won't work because the first
constraint will be dropped away, and I'll get ALL persons except Adam.

But if I use constraint list it's OK:

cmd.select(TABLE.getColumns());
List wheres = new ArrayList();
wheres.add(TABLE.NAME.like("A%"));
wheres.add(TABLE.NAME.isNot("Adam"));
cmd.addWhereConstraints(wheres);


Thanks,
Ivan

Reply via email to