Package io.jmix.core
Class FluentLoader.ByQuery<E>
java.lang.Object
io.jmix.core.FluentLoader.ByQuery<E>
- Enclosing class:
- FluentLoader<E>
-
Constructor Summary
ModifierConstructorDescriptionprotected
ByQuery
(FluentLoader<E> loader, String queryString, Object[] positionalParams, org.springframework.context.ApplicationContext applicationContext) protected
ByQuery
(FluentLoader<E> loader, String queryString, org.springframework.context.ApplicationContext applicationContext) -
Method Summary
Modifier and TypeMethodDescriptionaccessConstraints
(Class<? extends AccessConstraint> accessConstraintsClass) Adds registered access constraints that are subclasses of the given class.accessConstraints
(Collection<AccessConstraint<?>> accessConstraints) Adds access constraints.cacheable
(boolean cacheable) Indicates that the query results should be cached.Sets additional query condition.Sets a fetch plan.Sets a fetchPlan by name.fetchPlan
(Consumer<FetchPlanBuilder> fetchPlanBuilderConfigurer) Configure the fetch plan.fetchPlanProperties
(String... properties) Sets a fetch plan containing the given properties.firstResult
(int firstResult) Sets results offset.hint
(String hintName, Serializable value) Adds custom hint that should be used by the query.hints
(Map<String, Serializable> hints) Adds custom hints that should be used by the query.joinTransaction
(boolean join) Indicates that the operation must be performed in an existing transaction if it exists.list()
Loads a list of entities.lockMode
(jakarta.persistence.LockModeType lockMode) Sets a lock mode to be used when executing query.maxResults
(int maxResults) Sets results limit.one()
Loads a single instance.optional()
Loads a single instance and wraps it in Optional.Sets value for a query parameter.Sets value for a parameter ofjava.util.Date
type.parameters
(Map<String, Object> parameters) Adds the given parameters to the map of query parameters.Sets sorting, for examplesort(Sort.by("name"))
-
Constructor Details
-
ByQuery
protected ByQuery(FluentLoader<E> loader, String queryString, org.springframework.context.ApplicationContext applicationContext) -
ByQuery
protected ByQuery(FluentLoader<E> loader, String queryString, Object[] positionalParams, org.springframework.context.ApplicationContext applicationContext)
-
-
Method Details
-
list
Loads a list of entities. -
optional
Loads a single instance and wraps it in Optional. -
one
Loads a single instance.- Throws:
IllegalStateException
- if nothing was loaded
-
fetchPlan
Sets a fetch plan. -
fetchPlan
Sets a fetchPlan by name. -
fetchPlan
Configure the fetch plan. -
fetchPlanProperties
Sets a fetch plan containing the given properties. A property can be designated by a path in the entity graph. For example:dataManager.load(Pet.class) .query("...") .fetchPlanProperties( "name", "owner.name", "owner.address.city") .list();
-
hint
Adds custom hint that should be used by the query. -
hints
Adds custom hints that should be used by the query. -
condition
Sets additional query condition. -
parameter
Sets value for a query parameter.- Parameters:
name
- parameter namevalue
- parameter value
-
parameter
public FluentLoader.ByQuery<E> parameter(String name, @Nullable Date value, jakarta.persistence.TemporalType temporalType) Sets value for a parameter ofjava.util.Date
type.- Parameters:
name
- parameter namevalue
- parameter valuetemporalType
- how to interpret the value
-
parameters
Adds the given parameters to the map of query parameters. -
firstResult
Sets results offset. -
maxResults
Sets results limit. -
sort
Sets sorting, for examplesort(Sort.by("name"))
-
cacheable
Indicates that the query results should be cached. By default, queries are not cached. -
accessConstraints
Adds access constraints. -
accessConstraints
public FluentLoader.ByQuery<E> accessConstraints(Class<? extends AccessConstraint> accessConstraintsClass) Adds registered access constraints that are subclasses of the given class. -
joinTransaction
Indicates that the operation must be performed in an existing transaction if it exists. True by default. -
lockMode
Sets a lock mode to be used when executing query.
-