|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Junction<T>
Represents a Conjunction or a Disjunction.
Basically with a Conjunction you join together many expressions with AND, and with a Disjunction you join together many expressions with OR.
Note: where() always takes you to the top level WHERE expression list.
Query q =
Ebean.find(Person.class)
.where().disjunction()
.like("name","Rob%")
.eq("status",Status.NEW)
// where() returns us to the top level expression list
.where().gt("id", 10);
// read as...
// where ( ((name like Rob%) or (status = NEW)) AND (id > 10) )
Note: endJunction() takes you to the parent expression list
Query q =
Ebean.find(Person.class)
.where().disjunction()
.like("name","Rob%")
.eq("status",Status.NEW)
.endJunction()
// endJunction().. takes us to the 'parent' expression list
// which in this case is the top level (same as where())
.gt("id", 10);
// read as...
// where ( ((name like Rob%) or (status = NEW)) AND (id > 10) )
Example of a nested disjunction.
Query<Customer> q =
Ebean.find(Customer.class)
.where()
.disjunction()
.conjunction()
.startsWith("name", "r")
.eq("anniversary", onAfter)
.endJunction()
.conjunction()
.eq("status", Customer.Status.ACTIVE)
.gt("id", 0)
.endJunction()
.order().asc("name");
q.findList();
String s = q.getGeneratedSql();
// this produces an expression like:
( name like ? and c.anniversary = ? ) or (c.status = ? and c.id > ? )
| Method Summary |
|---|
| Methods inherited from interface com.avaje.ebean.ExpressionList |
|---|
add, addAll, allEq, and, between, betweenProperties, conjunction, contains, disjunction, endJunction, endsWith, eq, exampleLike, filterMany, findFutureIds, findFutureList, findFutureRowCount, findIds, findIterate, findList, findMap, findMap, findPagingList, findRowCount, findSet, findUnique, findVisit, ge, gt, having, icontains, idEq, idIn, iendsWith, ieq, iexampleLike, ilike, in, in, in, isNotNull, isNull, istartsWith, join, join, le, like, lt, ne, not, or, order, order, orderBy, orderBy, query, raw, raw, raw, select, setBackgroundFetchAfter, setFirstRow, setListener, setMapKey, setMaxRows, setOrderBy, setUseCache, startsWith, where |
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||