public interface Junction<T> extends Expression, ExpressionList<T>
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 =
DB.find(Person.class)
.where()
.or()
.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 =
DB.find(Person.class)
.where()
.or()
.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 =
DB.find(Customer.class)
.where()
.or()
.and()
.startsWith("name", "r")
.eq("anniversary", onAfter)
.endAnd()
.and()
.eq("status", Customer.Status.ACTIVE)
.gt("id", 0)
.endAnd()
.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 > ? )
Modifier and Type | Interface and Description |
---|---|
static class |
Junction.Type
The type of Junction used in full text expressions.
|
add, addAll, allEq, and, and, apply, arrayContains, arrayIsEmpty, arrayIsNotEmpty, arrayNotContains, asDraft, asDto, asOf, asUpdate, between, betweenProperties, bitwiseAll, bitwiseAnd, bitwiseAny, bitwiseNot, conjunction, contains, delete, delete, disjunction, endAnd, endJunction, endNot, endOr, endsWith, eq, eqOrNull, exampleLike, exists, exists, filterMany, findCount, findEach, findEachWhile, findFutureCount, findFutureIds, findFutureList, findIds, findIterate, findList, findMap, findOne, findOneOrEmpty, findPagedList, findSet, findSingleAttribute, findSingleAttributeList, findVersions, findVersionsBetween, forUpdate, forUpdateNoWait, forUpdateSkipLocked, ge, gt, gtOrNull, having, icontains, idEq, idIn, idIn, iendsWith, ieq, iexampleLike, ilike, in, in, in, ine, inOrEmpty, inPairs, inRange, inRangeWith, isEmpty, isIn, isIn, isIn, isNotEmpty, isNotNull, isNull, istartsWith, jsonBetween, jsonEqualTo, jsonExists, jsonGreaterOrEqual, jsonGreaterThan, jsonLessOrEqualTo, jsonLessThan, jsonNotEqualTo, jsonNotExists, le, like, lt, ltOrNull, match, match, multiMatch, multiMatch, must, mustNot, ne, not, not, notExists, notIn, notIn, notIn, or, or, order, order, orderBy, orderBy, query, raw, raw, raw, rawOrEmpty, select, select, setBeanCacheMode, setCountDistinct, setDisableLazyLoading, setDisableReadAuditing, setDistinct, setDocIndexName, setFirstRow, setIncludeSoftDeletes, setLabel, setMapKey, setMaxRows, setOrderBy, setUseCache, setUseDocStore, setUseQueryCache, setUseQueryCache, should, startsWith, textCommonTerms, textQueryString, textSimple, update, update, where
Copyright © 2019. All rights reserved.