Interface CrudRepository.InlineQuery<T,Q extends CrudRepository.InlineQuery<T,Q>>  
- Type Parameters:
- T-
- Q-
- All Known Subinterfaces:
- ValqueriesQuery<T>
- All Known Implementing Classes:
- BaseValqueriesQuery,- CrudRepoBaseQuery,- TestDoubleQuery,- TestDoubleQuery,- ValqueriesQueryImpl
- Enclosing interface:
- CrudRepository<T,K> 
CrudRepository. First, you specify any number of conditions, followed by a single
 terminal operation:
 
 - execute() to get the results as a Stream
 
 - count() to get the number of rows that match the query
 
 - delete() to delete all rows that match the query
 
 - distinct(Function) to get all distinct values of a field that match the query
 
 - selectField(Function) to get all values of a field that match the query
- 
Method SummaryModifier and TypeMethodDescriptionMatch if all the sub-conditions match.longcount()Count the number of rows that match the query.delete()Delete all entries that match the query.<X> Stream<X><X> Stream<X>Execute the query and return all distinct values of a field that match the query.eq(Property.PropertyValue<?> property) <X> Qeq(BiConsumer<T, X> field, X value) Match if the value of a field equals the specified value.<X> QMatch if the value of a field equals the specified value.execute()Execute the query and return the results as aStream.<X extends Comparable<? super X>>
 Qgt(Property.PropertyValue<X> property) <X extends Comparable<? super X>>
 Qgt(BiConsumer<T, X> field, X value) Match if the value of a field is greater than the specified value.<X extends Comparable<? super X>>
 QMatch if the value of a field is greater than the specified value.<X extends Comparable<? super X>>
 Qgte(Property.PropertyValue<X> property) <X extends Comparable<? super X>>
 Qgte(BiConsumer<T, X> field, X value) Match if the value of a field is greater than or equal to the specified value.<X extends Comparable<? super X>>
 QMatch if the value of a field is greater than or equal to the specified value.isNull(BiConsumer<T, ?> field) Match if the value of a field is null.Match if the value of a field is null.limit(int limit) Limit the results to the given number of rows.limit(int offset, int limit) Limit the results to the given number of rows, starting at the given offset.<X extends Comparable<? super X>>
 Qlt(Property.PropertyValue<X> property) <X extends Comparable<? super X>>
 Qlt(BiConsumer<T, X> field, X value) Match if the value of a field is less than the specified value.<X extends Comparable<? super X>>
 QMatch if the value of a field is less than the specified value.<X extends Comparable<? super X>>
 Qlte(Property.PropertyValue<X> property) <X extends Comparable<? super X>>
 Qlte(BiConsumer<T, X> field, X value) Match if the value of a field is less than or equal to the specified value.<X extends Comparable<? super X>>
 QMatch if the value of a field is less than or equal to the specified value.notEq(Property.PropertyValue<?> property) <X> QnotEq(BiConsumer<T, X> field, X value) Match if the value of a field is not equal to the specified value.<X> QMatch if the value of a field is not equal to the specified value.Match if any of the sub-conditions match.<X> Stream<X>selectField(Property<X> property) <X> Stream<X>selectField(Function<T, X> field) Execute the query and return all values of a field that match the query.<X extends Comparable<? super X>>
 QsortAscending(Property<X> property) <X extends Comparable<? super X>>
 QsortAscending(BiConsumer<T, X> field) Sort the results by the given field in ascending order.<X extends Comparable<? super X>>
 QsortAscending(Function<T, X> field) Sort the results by the given field in ascending order.<X extends Comparable<? super X>>
 QsortDescending(Property<X> property) <X extends Comparable<? super X>>
 QsortDescending(BiConsumer<T, X> property) Sort the results by the given field in descending order.<X extends Comparable<? super X>>
 QsortDescending(Function<T, X> property) Sort the results by the given field in descending order.<X,Z extends CrudRepository.InlineQuery<X, Z>> 
 QsubQuery(RelationDescriber relationDescriber, Consumer<Z> subQuery) withEager(RelationDescriber relation) withEager(BiConsumer<T, ?> field) Causes aRelationfield to be eagerly fetched.Causes aRelationfield to be eagerly fetched.
- 
Method Details- 
andMatch if all the sub-conditions match. The conditions in your sub query will be AND-ed together. Since this is the default behavior, this method is intended to be used insideor(Consumer).Example: 
 Will result into the following SQL:query.or(or -> or.eq(Person::getName, "Mike").and(and -> and.eq(Person::getName, "Bob").eq(Person::getAge, 42)));WHERE (name = 'Mike' OR (name = 'Bob' AND age = 42))- Parameters:
- subQuery- the sub query to be inside the AND statement
- Returns:
- the query, for chaining
 
- 
orMatch if any of the sub-conditions match. The conditions in your sub query will be OR-ed together.Example: 
 Will result into the following SQL:query.or(sub -> sub.eq(Person::getName, "Bob").eq(Person::getAge, 42));WHERE (name = 'Bob' OR age = 42)- Parameters:
- subQuery- the sub query to be inside the OR statement
- Returns:
- the query, for chaining
 
- 
eqMatch if the value of a field equals the specified value. If you want to match null values, you have to useisNull(Function).Example: query.eq(Person::getName, "Bob")This will match people with the name "Bob". - Type Parameters:
- X- the type of the field and value
- Parameters:
- field- a method reference to the getter of the field
- value- the value to check against
- Returns:
- the query, for chaining
 
- 
eqMatch if the value of a field equals the specified value. If you want to match null values, you have to useisNull(BiConsumer).Example: query.eq(Person::setName, "Bob")This will match people with the name "Bob". - Type Parameters:
- X- the type of the field and value
- Parameters:
- field- a method reference to the setter of the field
- value- the value to check against
- Returns:
- the query, for chaining
 
- 
notEqMatch if the value of a field is not equal to the specified value.Example: query.notEq(Person::getName, "Bob")This will match people with a name other than "Bob". - Type Parameters:
- X- the type of the field and value
- Parameters:
- field- a method reference to the getter of the field
- value- the value to check against
- Returns:
- the query, for chaining
 
- 
notEqMatch if the value of a field is not equal to the specified value.Example: query.notEq(Person::setName, "Bob")This will match people with a name other than "Bob". - Type Parameters:
- X- the type of the field and value
- Parameters:
- field- a method reference to the setter of the field
- value- the value to check against
- Returns:
- the query, for chaining
 
- 
gtMatch if the value of a field is greater than the specified value.Example: query.gt(Person::getAge, 18)This will match people older than 18. - Type Parameters:
- X- the type of the field and value
- Parameters:
- field- a method reference to the getter of the field
- value- the value to check against
- Returns:
- the query, for chaining
 
- 
gtMatch if the value of a field is greater than the specified value.Example: query.gt(Person::setAge, 18)This will match people older than 18. - Type Parameters:
- X- the type of the field and value
- Parameters:
- field- a method reference to the setter of the field
- value- the value to check against
- Returns:
- the query, for chaining
 
- 
ltMatch if the value of a field is less than the specified value.Example: query.lt(Person::getAge, 18)This will match people younger than 18. - Type Parameters:
- X- the type of the field and value
- Parameters:
- field- a method reference to the getter of the field
- value- the value to check against
- Returns:
- the query, for chaining
 
- 
ltMatch if the value of a field is less than the specified value.Example: query.lt(Person::setAge, 18)This will match people younger than 18. - Type Parameters:
- X- the type of the field and value
- Parameters:
- field- a method reference to the setter of the field
- value- the value to check against
- Returns:
- the query, for chaining
 
- 
gteMatch if the value of a field is greater than or equal to the specified value.Example: query.gte(Person::getAge, 18)This will match people that are 18 or older. - Type Parameters:
- X- the type of the field and value
- Parameters:
- field- a method reference to the getter of the field
- value- the value to check against
- Returns:
- the query, for chaining
 
- 
gteMatch if the value of a field is greater than or equal to the specified value.Example: query.gte(Person::setAge, 18)This will match people that are 18 or older. - Type Parameters:
- X- the type of the field and value
- Parameters:
- field- a method reference to the setter of the field
- value- the value to check against
- Returns:
- the query, for chaining
 
- 
lteMatch if the value of a field is less than or equal to the specified value.Example: query.lte(Person::getAge, 18)This will match people that are 18 or younger. - Type Parameters:
- X- the type of the field and value
- Parameters:
- field- a method reference to the getter of the field
- value- the value to check against
- Returns:
- the query, for chaining
 
- 
lteMatch if the value of a field is less than or equal to the specified value.Example: query.lte(Person::setAge, 18)This will match people that are 18 or younger. - Type Parameters:
- X- the type of the field and value
- Parameters:
- field- a method reference to the setter of the field
- value- the value to check against
- Returns:
- the query, for chaining
 
- 
isNullMatch if the value of a field is null.Example: query.isNull(Person::getEmail)This will match people whose email is null. Note: if the model class has fields of primitive type, they won't be null, even if the database contains NULL values. In this case isNull will still match correctly based on the values in the database. - Parameters:
- field- a method reference to the getter of the field
- Returns:
- the query, for chaining
 
- 
isNullMatch if the value of a field is null.Example: query.isNull(Person::setEmail)This will match people whose email is null. Note: if the model class has fields of primitive type, they won't be null, even if the database contains NULL values. In this case isNull will still match correctly based on the values in the database. - Parameters:
- field- a method reference to the setter of the field
- Returns:
- the query, for chaining
 
- 
withEagerCauses aRelationfield to be eagerly fetched. Useful to avoid multiple queries if you know that you will access the relation.Eagerness is defined by the implementation, but it generally means that the field will be fetched in the same query as the parent object, rather than in a separate query when the field is accessed (lazy loading). Example, returning a stream of all phones of people that are 18: query.eq(Person::getAge, 18).withEager(Person::getPhone).execute().map(Person::getPhone)This will result in one query to the database, instead of creating a separate query to get each phone. - Parameters:
- field- a method reference to the getter of the field
- Returns:
- the query, for chaining
 
- 
withEagerCauses aRelationfield to be eagerly fetched. Useful to avoid multiple queries if you know that you will access the relation.Eagerness is defined by the implementation, but it generally means that the field will be fetched in the same query as the parent object, rather than in a separate query when the field is accessed (lazy loading). Example, returning a stream of all phones of people that are 18: query.eq(Person::setAge, 18).withEager(Person::getPhone).execute().map(Person::getPhone)This will result in one query to the database, instead of creating a separate query to get each phone. - Parameters:
- field- a method reference to the setter of the field
- Returns:
- the query, for chaining
 
- 
sortAscendingSort the results by the given field in ascending order.Example: query.sortAscending(Person::getAge)This will sort the results by age in ascending order. - Type Parameters:
- X- the type of the field
- Parameters:
- field- a method reference to the getter of the field
- Returns:
- the query, for chaining
 
- 
sortAscendingSort the results by the given field in ascending order.Meant to be used with a setter method reference. Example: query.sortAscending(Person::setAge)This will sort the results by age in ascending order. - Type Parameters:
- X- the type of the field
- Parameters:
- field- a method reference to the setter of the field
- Returns:
- the query, for chaining
 
- 
sortDescendingSort the results by the given field in descending order.Example: query.sortDescending(Person::getAge)This will sort the results by age in descending order. - Type Parameters:
- X- the type of the field
- Parameters:
- property- a method reference to the getter of the field
- Returns:
- the query, for chaining
 
- 
sortDescendingSort the results by the given field in descending order.Meant to be used with a setter method reference. Example: query.sortDescending(Person::setAge)This will sort the results by age in descending order. - Type Parameters:
- X- the type of the field
- Parameters:
- property- a method reference to the setter of the field
- Returns:
- the query, for chaining
 
- 
limitLimit the results to the given number of rows, starting at the given offset.Offset is 0-based (the first row is 0). Offset is inclusive, limit is the size of the returned collection. Example: query.limit(10, 20)This will return rows 10, 11, 12, ..., 29. - Parameters:
- offset- the offset to start at
- limit- the number of rows to return
- Returns:
- the query, for chaining
- See Also:
 
- 
limitLimit the results to the given number of rows.Example: query.limit(10)This will return the first 10 rows. - Parameters:
- limit- the number of rows to return
- Returns:
- the query, for chaining
- See Also:
 
- 
executeExecute the query and return the results as aStream.This is a terminal operation. As such, the query should not be reused after this method is called. The resulting Streamfrom the operation may be a lazy stream, meaning that the results are not fetched from the database until they are accessed. As such it is important that a terminal operation is performed on the stream within a reasonable time frame to avoid holding database connections open.- Returns:
- a Streamof the results
 
- 
count@CheckReturnValue long count()Count the number of rows that match the query.This is a terminal operation. As such, the query should not be reused after this method is called. - Returns:
- the number of rows that match the query
 
- 
distinctExecute the query and return all distinct values of a field that match the query.This is useful if you need just a single field from an object, as it will only transfer that column over the network and will only deserialize that field. Sorting can be used, but only on the same column that is being selected. This is a terminal operation. As such, the query should not be reused after this method is called. The resulting Streamfrom the operation may be a lazy stream, meaning that the results are not fetched from the database until they are accessed. As such it is important that a terminal operation is performed on the stream within a reasonable time frame to avoid holding database connections open.- Type Parameters:
- X- the type of the field
- Parameters:
- field- a method reference to the getter of the field
- Returns:
- a Streamof distinct values of the field
 
- 
selectFieldExecute the query and return all values of a field that match the query.This is useful if you need just a single field from an object, as it will only transfer that column over the network and will only deserialize that field. This is a terminal operation. As such, the query should not be reused after this method is called. The resulting Streamfrom the operation may be a lazy stream, meaning that the results are not fetched from the database until they are accessed. As such it is important that a terminal operation is performed on the stream within a reasonable time frame to avoid holding database connections open.- Type Parameters:
- X- the type of the field
- Parameters:
- field- a method reference to the getter of the field
- Returns:
- a Streamof values of the field
 
- 
deleteCrudRepository.CrudUpdateResult delete()Delete all entries that match the query.This is a terminal operation. As such, the query should not be reused after this method is called. WARNING: If you invoke no query methods prior to this, all rows in the table with be deleted. - Returns:
- a CrudRepository.CrudUpdateResultwith the number of rows affected
- See Also:
 
- 
eq
- 
notEq
- 
gt
- 
gte
- 
lt
- 
lte
- 
isNull
- 
withEager
- 
sortAscending
- 
sortDescending
- 
subQuery<X,Z extends CrudRepository.InlineQuery<X, Q subQueryZ>> (RelationDescriber relationDescriber, Consumer<Z> subQuery) 
- 
distinct
- 
selectField
 
-