Where
Similary as into SQL, Daobab provides three kinds of where clause: and - Where.AND() or - Where.OR() not - Where.NOT()
Where field equal:
SQL: select * from pizza Pizza where pizza.id=4;
Select.entityListWhere(daoPizza.colPizzaId(),4);
Where IN:
SQL: select * from pizza Pizza where pizza.name in('CAPRICIOSA','PEPPERONI');
Select.entityList(daoPizza) .where(daoPizza.colName(),Operator.IN,Arrays.asList("CAPRICIOSA","PEPPERONI"))) .result();
Few fields condition with AND link:
SQL: select * from pizza Pizza where pizza.id=4 and pizza.name='CAPRICIOSA';
Select.from(daoPizza).where(Where.AND() .and(daoPizza.colPizzaId(),Operator.EQUAL,4) .and(daoPizza.colName(),Operator.EQUAL,'CAPRICIOSA')) .result();
AND together with OR:
SQL: select * from pizza Pizza where (pizza.id=4 and pizza.name='CAPRICIOSA') or (pizza.id=1 and pizza.name='MARHGETITA');
Select.from(daoPizza).where(Where.OR() .or(Where.AND() .and(daoPizza.colPizzaId(),Operator.EQUAL,4) .and(daoPizza.colName(),Operator.EQUAL,'CAPRICIOSA') ) .or(Where.AND() .and(daoPizza.colPizzaId(),Operator.EQUAL,1) .and(daoPizza.colName(),Operator.EQUAL,'MARHGETITA') )) .result();