Class ValqueriesQueryImpl<T>
- All Implemented Interfaces:
ValqueriesGroupQuery<T>
,ValqueriesQuery<T>
,Setter
,CrudRepository.InlineQuery<T,
,ValqueriesQuery<T>> AutoCloseable
-
Field Summary
Fields inherited from class com.valqueries.automapper.BaseValqueriesQuery
groupByProperties
Fields inherited from class io.ran.CrudRepoBaseQuery
clazz, instance, queryWrapper, typeDescriber
-
Constructor Summary
ConstructorsConstructorDescriptionValqueriesQueryImpl
(ITransactionContext transactionContext, Class<T> modelType, GenericFactory genericFactory, MappingHelper mappingHelper, SqlDialect dialect) -
Method Summary
Modifier and TypeMethodDescriptionand
(Consumer<ValqueriesQuery<T>> subQuery) Match if all the sub-conditions match.buildSimpleSelectSql
(String tableAlias, String where, Collection<String> columns) void
close()
protected void
long
count()
Count the number of rows that match the query.protected void
delete()
Delete all entries that match the query.<X> Stream<X>
eq
(Property.PropertyValue<?> propertyValue) execute()
Execute the query and return the results as aStream
.<X> Stream<X>
executeSqlAndGetSingleColumn
(Property<X> property, String sql) freetext
(Property.PropertyValue<String> propertyValue) getTableName
(Clazz<?> toClass) Execute the query.<X extends Comparable<? super X>>
ValqueriesQuery<T>gt
(Property.PropertyValue<X> propertyValue) <X extends Comparable<? super X>>
ValqueriesQuery<T>gte
(Property.PropertyValue<X> propertyValue) in
(Property.PropertyValueList<?> propertyValues) like
(Property.PropertyValue<String> propertyValue) 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>>
ValqueriesQuery<T>lt
(Property.PropertyValue<X> propertyValue) <X extends Comparable<? super X>>
ValqueriesQuery<T>lte
(Property.PropertyValue<X> propertyValue) protected <X extends Comparable<? super X>>
voidprotected <X extends Comparable<? super X>>
voidnotEq
(Property.PropertyValue<?> property) notIn
(Property.PropertyValueList<?> propertyValues) notLike
(Property.PropertyValue<String> propertyValue) or
(Consumer<ValqueriesQuery<T>> subQuery) Match if any of the sub-conditions match.<X> Stream<X>
selectField
(Property<X> property) void
set
(IStatement statement) void
setEmpty()
<X extends Comparable<? super X>>
ValqueriesQuery<T>sortAscending
(Property<X> property) <X extends Comparable<? super X>>
ValqueriesQuery<T>sortDescending
(Property<X> property) <X,
Z extends CrudRepository.InlineQuery<X, Z>>
ValqueriesQuery<T>subQuery
(RelationDescriber relation, Consumer<Z> consumer) protected void
update
(Consumer<ValqueriesUpdate<T>> updater) withEager
(RelationDescriber relation) Methods inherited from class com.valqueries.automapper.BaseValqueriesQuery
aggregateAll, concat, concat, count, count, distinct, freetext, freetext, groupBy, groupBy, in, in, in, in, isNotNull, isNotNull, like, like, max, max, min, min, notIn, notIn, notIn, notIn, notLike, notLike, selectField, subQuery, subQuery, subQueryList, subQueryList, subQueryList, sum, sum
Methods inherited from class io.ran.CrudRepoBaseQuery
eq, eq, gt, gt, gte, gte, isNull, isNull, lt, lt, lte, lte, notEq, notEq, sortAscending, sortAscending, sortDescending, sortDescending, withEager, withEager
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.ran.CrudRepository.InlineQuery
distinct, eq, eq, gt, gt, gte, gte, isNull, isNull, lt, lt, lte, lte, notEq, notEq, selectField, sortAscending, sortAscending, sortDescending, sortDescending, withEager, withEager
Methods inherited from interface com.valqueries.automapper.ValqueriesQuery
aggregateAll, freetext, freetext, groupBy, groupBy, in, in, in, in, isNotNull, isNotNull, like, like, notIn, notIn, notIn, notIn, notLike, notLike, subQuery, subQuery, subQueryList, subQueryList, subQueryList
-
Constructor Details
-
ValqueriesQueryImpl
public ValqueriesQueryImpl(ITransactionContext transactionContext, Class<T> modelType, GenericFactory genericFactory, MappingHelper mappingHelper, SqlDialect dialect)
-
-
Method Details
-
and
Description copied from interface:CrudRepository.InlineQuery
Match 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 insideCrudRepository.InlineQuery.or(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))
- Specified by:
and
in interfaceCrudRepository.InlineQuery<T,
ValqueriesQuery<T>> - Parameters:
subQuery
- the sub query to be inside the AND statement- Returns:
- the query, for chaining
-
or
Description copied from interface:CrudRepository.InlineQuery
Match 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)
- Specified by:
or
in interfaceCrudRepository.InlineQuery<T,
ValqueriesQuery<T>> - Parameters:
subQuery
- the sub query to be inside the OR statement- Returns:
- the query, for chaining
-
eq
- Specified by:
eq
in interfaceCrudRepository.InlineQuery<T,
ValqueriesQuery<T>>
-
notEq
- Specified by:
notEq
in interfaceCrudRepository.InlineQuery<T,
ValqueriesQuery<T>>
-
in
- Specified by:
in
in interfaceValqueriesQuery<T>
- Specified by:
in
in classBaseValqueriesQuery<T>
-
notIn
- Specified by:
notIn
in interfaceValqueriesQuery<T>
- Specified by:
notIn
in classBaseValqueriesQuery<T>
-
like
- Specified by:
like
in interfaceValqueriesQuery<T>
- Specified by:
like
in classBaseValqueriesQuery<T>
-
notLike
- Specified by:
notLike
in interfaceValqueriesQuery<T>
- Specified by:
notLike
in classBaseValqueriesQuery<T>
-
freetext
- Specified by:
freetext
in interfaceValqueriesQuery<T>
- Specified by:
freetext
in classBaseValqueriesQuery<T>
-
gt
public <X extends Comparable<? super X>> ValqueriesQuery<T> gt(Property.PropertyValue<X> propertyValue) - Specified by:
gt
in interfaceCrudRepository.InlineQuery<T,
ValqueriesQuery<T>>
-
gte
public <X extends Comparable<? super X>> ValqueriesQuery<T> gte(Property.PropertyValue<X> propertyValue) - Specified by:
gte
in interfaceCrudRepository.InlineQuery<T,
ValqueriesQuery<T>>
-
lt
public <X extends Comparable<? super X>> ValqueriesQuery<T> lt(Property.PropertyValue<X> propertyValue) - Specified by:
lt
in interfaceCrudRepository.InlineQuery<T,
ValqueriesQuery<T>>
-
lte
public <X extends Comparable<? super X>> ValqueriesQuery<T> lte(Property.PropertyValue<X> propertyValue) - Specified by:
lte
in interfaceCrudRepository.InlineQuery<T,
ValqueriesQuery<T>>
-
subQuery
public <X,Z extends CrudRepository.InlineQuery<X, ValqueriesQuery<T> subQueryZ>> (RelationDescriber relation, Consumer<Z> consumer) - Specified by:
subQuery
in interfaceCrudRepository.InlineQuery<T,
ValqueriesQuery<T>>
-
isNull
- Specified by:
isNull
in interfaceCrudRepository.InlineQuery<T,
ValqueriesQuery<T>>
-
isNotNull
- Specified by:
isNotNull
in interfaceValqueriesQuery<T>
- Specified by:
isNotNull
in classBaseValqueriesQuery<T>
-
buildSimpleSelectSql
-
getTableName
-
withEager
- Specified by:
withEager
in interfaceCrudRepository.InlineQuery<T,
ValqueriesQuery<T>>
-
sortAscending
- Specified by:
sortAscending
in interfaceCrudRepository.InlineQuery<T,
ValqueriesQuery<T>>
-
sortDescending
- Specified by:
sortDescending
in interfaceCrudRepository.InlineQuery<T,
ValqueriesQuery<T>>
-
limit
Description copied from interface:CrudRepository.InlineQuery
Limit 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.
- Specified by:
limit
in interfaceCrudRepository.InlineQuery<T,
ValqueriesQuery<T>> - Parameters:
offset
- the offset to start atlimit
- the number of rows to return- Returns:
- the query, for chaining
- See Also:
-
limit
Description copied from interface:CrudRepository.InlineQuery
Limit the results to the given number of rows.Example:
query.limit(10)
This will return the first 10 rows.
- Specified by:
limit
in interfaceCrudRepository.InlineQuery<T,
ValqueriesQuery<T>> - Parameters:
limit
- the number of rows to return- Returns:
- the query, for chaining
- See Also:
-
execute
Description copied from interface:CrudRepository.InlineQuery
Execute 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
Stream
from 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.- Specified by:
execute
in interfaceCrudRepository.InlineQuery<T,
ValqueriesQuery<T>> - Returns:
- a
Stream
of the results
-
count
public long count()Description copied from interface:CrudRepository.InlineQuery
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.
- Specified by:
count
in interfaceCrudRepository.InlineQuery<T,
ValqueriesQuery<T>> - Returns:
- the number of rows that match the query
-
distinct
- Specified by:
distinct
in interfaceCrudRepository.InlineQuery<T,
ValqueriesQuery<T>>
-
selectField
- Specified by:
selectField
in interfaceCrudRepository.InlineQuery<T,
ValqueriesQuery<T>>
-
executeSqlAndGetSingleColumn
-
count
- Specified by:
count
in classBaseValqueriesQuery<T>
-
sum
- Specified by:
sum
in classBaseValqueriesQuery<T>
-
max
- Specified by:
max
in classBaseValqueriesQuery<T>
-
min
- Specified by:
min
in classBaseValqueriesQuery<T>
-
concat
- Specified by:
concat
in classBaseValqueriesQuery<T>
-
delete
Description copied from interface:CrudRepository.InlineQuery
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.
- Specified by:
delete
in interfaceCrudRepository.InlineQuery<T,
ValqueriesQuery<T>> - Returns:
- a
CrudRepository.CrudUpdateResult
with the number of rows affected - See Also:
-
groupByExecute
Description copied from interface:ValqueriesGroupQuery
Execute the query.- Specified by:
groupByExecute
in interfaceValqueriesGroupQuery<T>
- Returns:
- A stream of rows, each containing the values of the fields that were grouped by and the values of the aggregations, both in the same order they were queried.
-
set
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
update
- Specified by:
update
in interfaceValqueriesQuery<T>
-
getTableAlias
-
setEmpty
public void setEmpty()
-