Interface DeleteStream<X>
- All Superinterfaces:
QueryConfigurer<CriteriaDelete<X>,
,X, Root<X>> QueryStream<X,
Root<X>, CriteriaDelete<X>, CriteriaDelete<X>, Query>
Stream
-like API.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.dellroad.querystream.jpa.QueryStream
QueryStream.Builder
-
Method Summary
Modifier and TypeMethodDescriptionBind an unbound reference to the items in this stream.<X2,
S2 extends Selection<X2>>
DeleteStream<X>Bind an unbound reference to the result of applying the given function to the items in this stream.int
delete()
Build and execute a JPA query based on this instance.filter
(SingularAttribute<? super X, Boolean> attribute) Filter results using the specified boolean property.Filter results using the boolean expression produced by the given function.Get theQueryType
of this instance.limit
(int maxSize) Return this stream truncated to the specified maximum length.Peek at the items in this stream.skip
(int num) Return this stream with the specified number of initial elements skipped.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> DeleteStream<X>
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.QueryConfigurer
configure
Methods inherited from interface org.dellroad.querystream.jpa.QueryStream
getEntityManager, getFirstResult, getFlushMode, getHints, getLockMode, getMaxResults, getParams, toCriteriaQuery, toQuery
-
Method Details
-
delete
int delete()Build and execute a JPA query based on this instance.Ultimately delegates to
Query.executeUpdate()
and can throw any exception thrown by that method.- Returns:
- the number of entities deleted
-
getQueryType
DeleteType<X> getQueryType()Description copied from interface:QueryStream
Get theQueryType
of this instance.- Specified by:
getQueryType
in interfaceQueryStream<X,
Root<X>, CriteriaDelete<X>, CriteriaDelete<X>, Query> - Returns:
- associated
QueryType
-
bind
Description copied from interface:QueryStream
Bind an unbound reference to the items in this stream.- Specified by:
bind
in interfaceQueryStream<X,
Root<X>, CriteriaDelete<X>, CriteriaDelete<X>, Query> - Parameters:
ref
- unbound reference- Returns:
- new stream that binds
ref
-
bind
<X2,S2 extends Selection<X2>> DeleteStream<X> bind(Ref<X2, ? super S2> ref, Function<? super Root<X>, ? 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 interfaceQueryStream<X,
Root<X>, CriteriaDelete<X>, CriteriaDelete<X>, Query> - 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
-
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 interfaceQueryStream<X,
Root<X>, CriteriaDelete<X>, CriteriaDelete<X>, Query> - Parameters:
peeker
- peeker into stream- Returns:
- new stream that peeks into this stream
-
filter
Description copied from interface:QueryStream
Filter results using the specified boolean property.Adds to any previously specified filters.
- Specified by:
filter
in interfaceQueryStream<X,
Root<X>, CriteriaDelete<X>, CriteriaDelete<X>, Query> - Parameters:
attribute
- boolean property- Returns:
- new filtered stream
-
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 interfaceQueryStream<X,
Root<X>, CriteriaDelete<X>, CriteriaDelete<X>, Query> - Parameters:
predicateBuilder
- function mapping this stream's item to a booleanExpression
- Returns:
- new filtered stream
-
limit
Description copied from interface:QueryStream
Return this stream truncated to the specified maximum length.Due to limitations in the JPA Criteria API, this method is not supported on subquery streams and in general must be specified last (after any filtering, sorting, grouping, joins, etc.).
- Specified by:
limit
in interfaceQueryStream<X,
Root<X>, CriteriaDelete<X>, CriteriaDelete<X>, Query> - Parameters:
maxSize
- maximum number of elements to return- Returns:
- new truncated stream
-
skip
Description copied from interface:QueryStream
Return this stream with the specified number of initial elements skipped.Due to limitations in the JPA Criteria API, this method is not supported on subquery streams and in general must be specified last (after any filtering, sorting, grouping, joins, etc.).
- Specified by:
skip
in interfaceQueryStream<X,
Root<X>, CriteriaDelete<X>, CriteriaDelete<X>, Query> - Parameters:
num
- number of elements to skip- Returns:
- new elided stream
-
withFlushMode
Description copied from interface:QueryStream
Set theFlushModeType
associated with this query.- Specified by:
withFlushMode
in interfaceQueryStream<X,
Root<X>, CriteriaDelete<X>, CriteriaDelete<X>, Query> - 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 interfaceQueryStream<X,
Root<X>, CriteriaDelete<X>, CriteriaDelete<X>, Query> - 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 interfaceQueryStream<X,
Root<X>, CriteriaDelete<X>, CriteriaDelete<X>, Query> - 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 interfaceQueryStream<X,
Root<X>, CriteriaDelete<X>, CriteriaDelete<X>, Query> - 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 interfaceQueryStream<X,
Root<X>, CriteriaDelete<X>, CriteriaDelete<X>, Query> - 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 interfaceQueryStream<X,
Root<X>, CriteriaDelete<X>, CriteriaDelete<X>, Query> - 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 interfaceQueryStream<X,
Root<X>, CriteriaDelete<X>, CriteriaDelete<X>, Query> - 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 interfaceQueryStream<X,
Root<X>, CriteriaDelete<X>, CriteriaDelete<X>, Query> - 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 interfaceQueryStream<X,
Root<X>, CriteriaDelete<X>, CriteriaDelete<X>, Query> - 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 interfaceQueryStream<X,
Root<X>, CriteriaDelete<X>, CriteriaDelete<X>, Query> - Parameters:
name
- name of fetch graph- Returns:
- new stream with the specified fetch graph configured
-