Package org.dellroad.querystream.jpa
Interface LongValue
- All Superinterfaces:
ExprStream<Long,
,Expression<Long>> ExprValue<Long,
,Expression<Long>> LongStream
,QueryConfigurer<AbstractQuery<?>,
,Long, Expression<Long>> QueryStream<Long,
,Expression<Long>, AbstractQuery<?>, CriteriaQuery<Long>, TypedQuery<Long>> SearchStream<Long,
,Expression<Long>> SearchValue<Long,
Expression<Long>>
A long
ExprValue
.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.dellroad.querystream.jpa.QueryStream
QueryStream.Builder
-
Method Summary
Modifier and TypeMethodDescriptionbind
(Ref<Long, ? super Expression<Long>> ref) Bind an unbound reference to the items in this stream.bind
(Ref<X2, ? super S2> ref, Function<? super Expression<Long>, ? extends S2> refFunction) Bind an unbound reference to the result of applying the given function to the items in this stream.filter
(Function<? super Expression<Long>, ? extends Expression<Boolean>> predicateBuilder) Filter results using the boolean expression produced by the given function.default long
Build and evaluate a JPA query based on this instance and return the single non-NULL result.peek
(Consumer<? super Expression<Long>> peeker) Peek at the items in this stream.withFetchGraph
(String name) Configure a fetch graph for this query.withFlushMode
(FlushModeType flushMode) Set theFlushModeType
associated with this query.Associate a hint with this query.Associate hints with this query.withLoadGraph
(String name) Configure a load graph for this query.withLockMode
(LockModeType lockMode) Set theLockModeType
associated with this query.withParam
(Parameter<Calendar> parameter, Calendar value, TemporalType temporalType) Bind the value of a query parameter of typeCalendar
.withParam
(Parameter<Date> parameter, Date value, TemporalType temporalType) Bind the value of a query parameter of typeDate
.<T> LongValue
Bind the value of a query parameter.withParams
(Iterable<? extends ParamBinding<?>> params) Associate parameter bindings with this query.Methods inherited from interface org.dellroad.querystream.jpa.ExprStream
asSubquery, count, countDistinct, exists, fetch, fetch, fetch, fetch, filter, groupBy, orderBy, orderBy, orderBy, thenOrderBy
Methods inherited from interface org.dellroad.querystream.jpa.ExprValue
filter, map, map, map, map, mapToDouble, mapToDouble, mapToExpr, mapToFrom, mapToInt, mapToInt, mapToLong, mapToLong, mapToPath
Methods inherited from interface org.dellroad.querystream.jpa.LongStream
addRoot, asDoubleStream, average, distinct, findAny, findFirst, findSingle, groupBy, groupBy, groupByMulti, having, limit, max, min, orderBy, orderBy, orderBy, orderByMulti, skip, sum, thenOrderBy, thenOrderBy, thenOrderBy
Methods inherited from interface org.dellroad.querystream.jpa.QueryConfigurer
configure
Methods inherited from interface org.dellroad.querystream.jpa.QueryStream
getEntityManager, getFirstResult, getFlushMode, getHints, getLockMode, getMaxResults, getParams, toCriteriaQuery, toQuery
Methods inherited from interface org.dellroad.querystream.jpa.SearchStream
allMatch, allMatch, anyMatch, anyMatch, flatMap, flatMap, flatMap, flatMapKeys, flatMapValues, getQueryType, getResultList, getResultStream, isEmpty, join, join, join, join, join, join, join, join, join, join, join, join, join, join, join, mapToRef, mapToRef, mapToRef, mapToRef, mapToRoot, noneMatch, noneMatch
Methods inherited from interface org.dellroad.querystream.jpa.SearchValue
ifPresent, isPresent, mapToSelection, orElse, orElseGet, orElseThrow, toOptional, value
-
Method Details
-
longValue
default long longValue()Build and evaluate a JPA query based on this instance and return the single non-NULL result.This variant of
SearchValue.value()
is useful when it is known that NULL won't be returned.- Returns:
- result of executed query
- Throws:
NoResultException
- if the query returns NULL
-
bind
Description copied from interface:QueryStream
Bind an unbound reference to the items in this stream.- Specified by:
bind
in interfaceExprStream<Long,
Expression<Long>> - Specified by:
bind
in interfaceExprValue<Long,
Expression<Long>> - Specified by:
bind
in interfaceLongStream
- Specified by:
bind
in interfaceQueryStream<Long,
Expression<Long>, AbstractQuery<?>, CriteriaQuery<Long>, TypedQuery<Long>> - Specified by:
bind
in interfaceSearchStream<Long,
Expression<Long>> - Specified by:
bind
in interfaceSearchValue<Long,
Expression<Long>> - Parameters:
ref
- unbound reference- Returns:
- new stream that binds
ref
-
peek
Description copied from interface:QueryStream
Peek at the items in this stream.This is useful in cases where the selection can be modified, e.g., setting join
ON
conditions usingJoin.on()
.- Specified by:
peek
in interfaceExprStream<Long,
Expression<Long>> - Specified by:
peek
in interfaceExprValue<Long,
Expression<Long>> - Specified by:
peek
in interfaceLongStream
- Specified by:
peek
in interfaceQueryStream<Long,
Expression<Long>, AbstractQuery<?>, CriteriaQuery<Long>, TypedQuery<Long>> - Specified by:
peek
in interfaceSearchStream<Long,
Expression<Long>> - Specified by:
peek
in interfaceSearchValue<Long,
Expression<Long>> - Parameters:
peeker
- peeker into stream- Returns:
- new stream that peeks into this stream
-
bind
<X2,S2 extends Selection<X2>> LongValue bind(Ref<X2, ? super S2> ref, Function<? super Expression<Long>, ? extends S2> refFunction) Description copied from interface:QueryStream
Bind an unbound reference to the result of applying the given function to the items in this stream.- Specified by:
bind
in interfaceExprStream<Long,
Expression<Long>> - Specified by:
bind
in interfaceExprValue<Long,
Expression<Long>> - Specified by:
bind
in interfaceLongStream
- Specified by:
bind
in interfaceQueryStream<Long,
Expression<Long>, AbstractQuery<?>, CriteriaQuery<Long>, TypedQuery<Long>> - Specified by:
bind
in interfaceSearchStream<Long,
Expression<Long>> - Specified by:
bind
in interfaceSearchValue<Long,
Expression<Long>> - Type Parameters:
X2
- type of the bound valueS2
- criteria type of the bound value- Parameters:
ref
- unbound referencerefFunction
- function mapping this stream'sSelection
to the reference value- Returns:
- new stream that binds
ref
-
filter
Description copied from interface:QueryStream
Filter results using the boolean expression produced by the given function.Adds to any previously specified filters.
- Specified by:
filter
in interfaceExprStream<Long,
Expression<Long>> - Specified by:
filter
in interfaceExprValue<Long,
Expression<Long>> - Specified by:
filter
in interfaceLongStream
- Specified by:
filter
in interfaceQueryStream<Long,
Expression<Long>, AbstractQuery<?>, CriteriaQuery<Long>, TypedQuery<Long>> - Specified by:
filter
in interfaceSearchStream<Long,
Expression<Long>> - Specified by:
filter
in interfaceSearchValue<Long,
Expression<Long>> - Parameters:
predicateBuilder
- function mapping this stream's item to a booleanExpression
- Returns:
- new filtered stream
-
withFlushMode
Description copied from interface:QueryStream
Set theFlushModeType
associated with this query.- Specified by:
withFlushMode
in interfaceExprStream<Long,
Expression<Long>> - Specified by:
withFlushMode
in interfaceExprValue<Long,
Expression<Long>> - Specified by:
withFlushMode
in interfaceLongStream
- Specified by:
withFlushMode
in interfaceQueryStream<Long,
Expression<Long>, AbstractQuery<?>, CriteriaQuery<Long>, TypedQuery<Long>> - Specified by:
withFlushMode
in interfaceSearchStream<Long,
Expression<Long>> - Specified by:
withFlushMode
in interfaceSearchValue<Long,
Expression<Long>> - Parameters:
flushMode
- new flush mode- Returns:
- new stream with the specified flush mode configured
- See Also:
-
withLockMode
Description copied from interface:QueryStream
Set theLockModeType
associated with this query.- Specified by:
withLockMode
in interfaceExprStream<Long,
Expression<Long>> - Specified by:
withLockMode
in interfaceExprValue<Long,
Expression<Long>> - Specified by:
withLockMode
in interfaceLongStream
- Specified by:
withLockMode
in interfaceQueryStream<Long,
Expression<Long>, AbstractQuery<?>, CriteriaQuery<Long>, TypedQuery<Long>> - Specified by:
withLockMode
in interfaceSearchStream<Long,
Expression<Long>> - Specified by:
withLockMode
in interfaceSearchValue<Long,
Expression<Long>> - Parameters:
lockMode
- new lock mode- Returns:
- new stream with the specified lock mode configured
- See Also:
-
withHint
Description copied from interface:QueryStream
Associate a hint with this query.- Specified by:
withHint
in interfaceExprStream<Long,
Expression<Long>> - Specified by:
withHint
in interfaceExprValue<Long,
Expression<Long>> - Specified by:
withHint
in interfaceLongStream
- Specified by:
withHint
in interfaceQueryStream<Long,
Expression<Long>, AbstractQuery<?>, CriteriaQuery<Long>, TypedQuery<Long>> - Specified by:
withHint
in interfaceSearchStream<Long,
Expression<Long>> - Specified by:
withHint
in interfaceSearchValue<Long,
Expression<Long>> - Parameters:
name
- name of hintvalue
- value of hint- Returns:
- new stream with the specified hint configured
- See Also:
-
withHints
Description copied from interface:QueryStream
Associate hints with this query.- Specified by:
withHints
in interfaceExprStream<Long,
Expression<Long>> - Specified by:
withHints
in interfaceExprValue<Long,
Expression<Long>> - Specified by:
withHints
in interfaceLongStream
- Specified by:
withHints
in interfaceQueryStream<Long,
Expression<Long>, AbstractQuery<?>, CriteriaQuery<Long>, TypedQuery<Long>> - Specified by:
withHints
in interfaceSearchStream<Long,
Expression<Long>> - Specified by:
withHints
in interfaceSearchValue<Long,
Expression<Long>> - Parameters:
hints
- hints to add- Returns:
- new stream with the specified hints added
- See Also:
-
withParam
Description copied from interface:QueryStream
Bind the value of a query parameter.Replaces any previous binding of the same parameter.
- Specified by:
withParam
in interfaceExprStream<Long,
Expression<Long>> - Specified by:
withParam
in interfaceExprValue<Long,
Expression<Long>> - Specified by:
withParam
in interfaceLongStream
- Specified by:
withParam
in interfaceQueryStream<Long,
Expression<Long>, AbstractQuery<?>, CriteriaQuery<Long>, TypedQuery<Long>> - Specified by:
withParam
in interfaceSearchStream<Long,
Expression<Long>> - Specified by:
withParam
in interfaceSearchValue<Long,
Expression<Long>> - Type Parameters:
T
- parameter value type- Parameters:
parameter
- the parameter to setvalue
- parameter value- Returns:
- new stream with the specified parameter value set
- See Also:
-
withParam
Description copied from interface:QueryStream
Bind the value of a query parameter of typeDate
.Replaces any previous binding of the same parameter.
- Specified by:
withParam
in interfaceExprStream<Long,
Expression<Long>> - Specified by:
withParam
in interfaceExprValue<Long,
Expression<Long>> - Specified by:
withParam
in interfaceLongStream
- Specified by:
withParam
in interfaceQueryStream<Long,
Expression<Long>, AbstractQuery<?>, CriteriaQuery<Long>, TypedQuery<Long>> - Specified by:
withParam
in interfaceSearchStream<Long,
Expression<Long>> - Specified by:
withParam
in interfaceSearchValue<Long,
Expression<Long>> - Parameters:
parameter
- the parameter to setvalue
- parameter valuetemporalType
- temporal type forvalue
- Returns:
- new stream with the specified parameter value set
- See Also:
-
withParam
Description copied from interface:QueryStream
Bind the value of a query parameter of typeCalendar
.Replaces any previous binding of the same parameter.
- Specified by:
withParam
in interfaceExprStream<Long,
Expression<Long>> - Specified by:
withParam
in interfaceExprValue<Long,
Expression<Long>> - Specified by:
withParam
in interfaceLongStream
- Specified by:
withParam
in interfaceQueryStream<Long,
Expression<Long>, AbstractQuery<?>, CriteriaQuery<Long>, TypedQuery<Long>> - Specified by:
withParam
in interfaceSearchStream<Long,
Expression<Long>> - Specified by:
withParam
in interfaceSearchValue<Long,
Expression<Long>> - Parameters:
parameter
- the parameter to setvalue
- parameter valuetemporalType
- temporal type forvalue
- Returns:
- new stream with the specified parameter value set
- See Also:
-
withParams
Description copied from interface:QueryStream
Associate parameter bindings with this query.Replaces any previous bindings of the same parameters.
- Specified by:
withParams
in interfaceExprStream<Long,
Expression<Long>> - Specified by:
withParams
in interfaceExprValue<Long,
Expression<Long>> - Specified by:
withParams
in interfaceLongStream
- Specified by:
withParams
in interfaceQueryStream<Long,
Expression<Long>, AbstractQuery<?>, CriteriaQuery<Long>, TypedQuery<Long>> - Specified by:
withParams
in interfaceSearchStream<Long,
Expression<Long>> - Specified by:
withParams
in interfaceSearchValue<Long,
Expression<Long>> - Parameters:
params
- bindings to add- Returns:
- new stream with the specified parameter bindings added
- See Also:
-
withLoadGraph
Description copied from interface:QueryStream
Configure a load graph for this query.Equivalent to
withHint
("jakarta.persistence.loadgraph", name)
.- Specified by:
withLoadGraph
in interfaceExprStream<Long,
Expression<Long>> - Specified by:
withLoadGraph
in interfaceExprValue<Long,
Expression<Long>> - Specified by:
withLoadGraph
in interfaceLongStream
- Specified by:
withLoadGraph
in interfaceQueryStream<Long,
Expression<Long>, AbstractQuery<?>, CriteriaQuery<Long>, TypedQuery<Long>> - Specified by:
withLoadGraph
in interfaceSearchStream<Long,
Expression<Long>> - Specified by:
withLoadGraph
in interfaceSearchValue<Long,
Expression<Long>> - Parameters:
name
- name of load graph- Returns:
- new stream with the specified load graph configured
-
withFetchGraph
Description copied from interface:QueryStream
Configure a fetch graph for this query.Equivalent to
withHint
("jakarta.persistence.fetchgraph", name)
.- Specified by:
withFetchGraph
in interfaceExprStream<Long,
Expression<Long>> - Specified by:
withFetchGraph
in interfaceExprValue<Long,
Expression<Long>> - Specified by:
withFetchGraph
in interfaceLongStream
- Specified by:
withFetchGraph
in interfaceQueryStream<Long,
Expression<Long>, AbstractQuery<?>, CriteriaQuery<Long>, TypedQuery<Long>> - Specified by:
withFetchGraph
in interfaceSearchStream<Long,
Expression<Long>> - Specified by:
withFetchGraph
in interfaceSearchValue<Long,
Expression<Long>> - Parameters:
name
- name of fetch graph- Returns:
- new stream with the specified fetch graph configured
-