java.lang.Object
io.ebean.typequery.TQProperty<R,Object>
io.ebean.typequery.TQAssoc<T,R>
- Type Parameters:
T- the entity bean type (normal entity bean type e.g. Customer)R- the specific root query bean type (e.g. QCustomer)
- All Implemented Interfaces:
io.ebean.Query.Property<Object>
- Direct Known Subclasses:
TQAssocBean
Base type for associated beans.
-
Field Summary
Fields inherited from class io.ebean.typequery.TQProperty
_name, _root -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal RIs equal to by ID property.final ReqIfPresent(@Nullable T other) Is EQUAL TO if value is non-null and otherwise no expression is added to the query.final RIs equal to by ID property.final Rin(Collection<T> values) Is in a list of values.final RIs in a list of values.final RinOrEmpty(Collection<T> values) In where null or empty values means that no predicate is added to the query.final RIs not equal to by ID property.final RnotEqualTo(T other) Is not equal to by ID property.final RnotIn(Collection<T> values) Is NOT in a list of values.final RIs NOT in a list of values.Methods inherited from class io.ebean.typequery.TQProperty
expr, isNotNull, isNull, propertyName, toString
-
Constructor Details
-
TQAssoc
Construct with a property name and root instance.- Parameters:
name- the name of the propertyroot- the root query bean instance
-
TQAssoc
Construct with additional path prefix.
-
-
Method Details
-
eq
Is equal to by ID property. -
eqIfPresent
Is EQUAL TO if value is non-null and otherwise no expression is added to the query.This is effectively a helper method that allows a query to be built in fluid style where some predicates are effectively optional. We can use
eqIfPresent()rather than having a separate if block. -
equalTo
Is equal to by ID property. -
ne
Is not equal to by ID property. -
notEqualTo
Is not equal to by ID property. -
in
Is in a list of values.- Parameters:
values- the list of values for the predicate- Returns:
- the root query bean instance
-
in
Is in a list of values.- Parameters:
values- the list of values for the predicate- Returns:
- the root query bean instance
-
inOrEmpty
In where null or empty values means that no predicate is added to the query.That is, only add the IN predicate if the values are not null or empty.
Without this we typically need to code an
ifblock to only add the IN predicate if the collection is not empty like:Without inOrEmpty()
List<String> names = Arrays.asList("foo", "bar"); QCustomer query = new QCustomer() .registered.before(LocalDate.now()) // conditionally add the IN expression to the query if (names != null && !names.isEmpty()) { query.name.in(names) } query.findList();Using inOrEmpty()
List<String> names = Arrays.asList("foo", "bar"); new QCustomer() .registered.before(LocalDate.now()) .name.inOrEmpty(names) .findList(); -
notIn
Is NOT in a list of values.- Parameters:
values- the list of values for the predicate- Returns:
- the root query bean instance
-
notIn
Is NOT in a list of values.- Parameters:
values- the list of values for the predicate- Returns:
- the root query bean instance
-