public static class FluentLoader.ByQuery<E>
extends java.lang.Object
Modifier | Constructor and Description |
---|---|
protected |
ByQuery(FluentLoader<E> loader,
java.lang.String queryString,
org.springframework.context.ApplicationContext applicationContext) |
protected |
ByQuery(FluentLoader<E> loader,
java.lang.String queryString,
java.lang.Object[] positionalParams,
org.springframework.context.ApplicationContext applicationContext) |
Modifier and Type | Method and Description |
---|---|
FluentLoader.ByQuery<E> |
accessConstraints(java.lang.Class<? extends AccessConstraint> accessConstraintsClass)
Adds registered access constraints that are subclasses of the given class.
|
FluentLoader.ByQuery<E> |
accessConstraints(java.util.Collection<AccessConstraint<?>> accessConstraints)
Adds access constraints.
|
FluentLoader.ByQuery<E> |
cacheable(boolean cacheable)
Indicates that the query results should be cached.
|
FluentLoader.ByCondition<E> |
condition(Condition condition)
Sets additional query condition.
|
FluentLoader.ByQuery<E> |
fetchPlan(java.util.function.Consumer<FetchPlanBuilder> fetchPlanBuilderConfigurer)
Configure the fetch plan.
|
FluentLoader.ByQuery<E> |
fetchPlan(FetchPlan fetchPlan)
Sets a fetch plan.
|
FluentLoader.ByQuery<E> |
fetchPlan(java.lang.String fetchPlanName)
Sets a fetchPlan by name.
|
FluentLoader.ByQuery<E> |
fetchPlanProperties(java.lang.String... properties)
Sets a fetch plan containing the given properties.
|
FluentLoader.ByQuery<E> |
firstResult(int firstResult)
Sets results offset.
|
FluentLoader.ByQuery<E> |
hint(java.lang.String hintName,
java.io.Serializable value)
Adds custom hint that should be used by the query.
|
FluentLoader.ByQuery<E> |
hints(java.util.Map<java.lang.String,java.io.Serializable> hints)
Adds custom hints that should be used by the query.
|
FluentLoader.ByQuery<E> |
joinTransaction(boolean join)
Indicates that the operation must be performed in an existing transaction if it exists.
|
java.util.List<E> |
list()
Loads a list of entities.
|
FluentLoader.ByQuery<E> |
maxResults(int maxResults)
Sets results limit.
|
E |
one()
Loads a single instance.
|
java.util.Optional<E> |
optional()
Loads a single instance and wraps it in Optional.
|
FluentLoader.ByQuery<E> |
parameter(java.lang.String name,
java.util.Date value,
javax.persistence.TemporalType temporalType)
Sets value for a parameter of
java.util.Date type. |
FluentLoader.ByQuery<E> |
parameter(java.lang.String name,
java.lang.Object value)
Sets value for a query parameter.
|
FluentLoader.ByQuery<E> |
parameters(java.util.Map<java.lang.String,java.lang.Object> parameters)
Adds the given parameters to the map of query parameters.
|
FluentLoader.ByQuery<E> |
sort(Sort sort)
Sets sorting, for example
sort(Sort.by("name")) |
protected ByQuery(FluentLoader<E> loader, java.lang.String queryString, org.springframework.context.ApplicationContext applicationContext)
protected ByQuery(FluentLoader<E> loader, java.lang.String queryString, java.lang.Object[] positionalParams, org.springframework.context.ApplicationContext applicationContext)
public java.util.List<E> list()
public java.util.Optional<E> optional()
public E one()
java.lang.IllegalStateException
- if nothing was loadedpublic FluentLoader.ByQuery<E> fetchPlan(@Nullable FetchPlan fetchPlan)
public FluentLoader.ByQuery<E> fetchPlan(@Nullable java.lang.String fetchPlanName)
public FluentLoader.ByQuery<E> fetchPlan(java.util.function.Consumer<FetchPlanBuilder> fetchPlanBuilderConfigurer)
public FluentLoader.ByQuery<E> fetchPlanProperties(java.lang.String... properties)
dataManager.load(Pet.class) .query("...") .fetchPlanProperties( "name", "owner.name", "owner.address.city") .list();
public FluentLoader.ByQuery<E> hint(java.lang.String hintName, java.io.Serializable value)
public FluentLoader.ByQuery<E> hints(java.util.Map<java.lang.String,java.io.Serializable> hints)
public FluentLoader.ByCondition<E> condition(Condition condition)
public FluentLoader.ByQuery<E> parameter(java.lang.String name, java.lang.Object value)
name
- parameter namevalue
- parameter valuepublic FluentLoader.ByQuery<E> parameter(java.lang.String name, java.util.Date value, javax.persistence.TemporalType temporalType)
java.util.Date
type.name
- parameter namevalue
- parameter valuetemporalType
- how to interpret the valuepublic FluentLoader.ByQuery<E> parameters(java.util.Map<java.lang.String,java.lang.Object> parameters)
public FluentLoader.ByQuery<E> firstResult(int firstResult)
public FluentLoader.ByQuery<E> maxResults(int maxResults)
public FluentLoader.ByQuery<E> sort(Sort sort)
sort(Sort.by("name"))
public FluentLoader.ByQuery<E> cacheable(boolean cacheable)
public FluentLoader.ByQuery<E> accessConstraints(java.util.Collection<AccessConstraint<?>> accessConstraints)
public FluentLoader.ByQuery<E> accessConstraints(java.lang.Class<? extends AccessConstraint> accessConstraintsClass)
public FluentLoader.ByQuery<E> joinTransaction(boolean join)