Package io.jmix.core
Class ValueLoadContext
java.lang.Object
io.jmix.core.ValueLoadContext
- All Implemented Interfaces:
DataLoadContext
,Serializable
Class that defines parameters for loading values from the database via
UnconstrainedDataManager.loadValues(ValueLoadContext)
.
Typical usage:
ValueLoadContext context = ValueLoadContext.create() .setQuery(ValueLoadContext.createQuery("select e.id, e.name from sample$Customer e where e.grade = :grade") .setParameter("grade", 1)) .addProperty("id") .addProperty("name");
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Class that defines a query to be executed for loading values. -
Field Summary
Modifier and TypeFieldDescriptionprotected List<AccessConstraint<?>>
protected Map<String,
Serializable> protected String
protected boolean
protected jakarta.persistence.LockModeType
protected ValueLoadContext.Query
protected boolean
protected String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddProperty
(String name) Adds a key of a returned key-value pair.static ValueLoadContext
create()
Creates an instance of ValueLoadContextstatic ValueLoadContext.Query
createQuery
(String queryString) Creates an instance of ValueLoadContext queryList<AccessConstraint<?>>
getHints()
jakarta.persistence.LockModeType
getQuery()
boolean
setAccessConstraints
(List<AccessConstraint<?>> accessConstraints) setHint
(String hintName, Serializable value) Sets custom hint that should be used by the query.setHints
(Map<String, Serializable> hints) Sets custom hints that should be used by the query.void
Sets name of the property that represents an identifier of the returned KeyValueEntity.setJoinTransaction
(boolean joinTransaction) void
setLockMode
(jakarta.persistence.LockModeType lockMode) setProperties
(List<String> properties) The same as invokingaddProperty(String)
multiple times.setQuery
(ValueLoadContext.Query query) Sets query instancesetQueryString
(String queryString) setStoreName
(String storeName) Sets a data store name if it is different from the main database.toString()
-
Field Details
-
storeName
-
query
-
softDeletion
protected boolean softDeletion -
idName
-
properties
-
accessConstraints
-
hints
-
joinTransaction
protected boolean joinTransaction -
lockMode
protected jakarta.persistence.LockModeType lockMode
-
-
Constructor Details
-
ValueLoadContext
public ValueLoadContext()
-
-
Method Details
-
create
Creates an instance of ValueLoadContext -
createQuery
Creates an instance of ValueLoadContext query -
setQueryString
- Specified by:
setQueryString
in interfaceDataLoadContext
- Parameters:
queryString
- JPQL query string. Only named parameters are supported.- Returns:
- query definition object
-
setLockMode
public void setLockMode(jakarta.persistence.LockModeType lockMode) - Specified by:
setLockMode
in interfaceDataLoadContext
- Parameters:
lockMode
- lock mode to be used when executing query
-
getLockMode
@Nullable public jakarta.persistence.LockModeType getLockMode()- Specified by:
getLockMode
in interfaceDataLoadContext
- Returns:
- lock mode to be used when executing query
-
getStoreName
- Returns:
- data store name if set by
setStoreName(String)
-
setStoreName
Sets a data store name if it is different from the main database.- Returns:
- this instance for chaining
-
setQuery
Sets query instance- Returns:
- this instance for chaining
-
getQuery
- Returns:
- query instance
-
getHints
- Returns:
- custom hints which are used by the query
-
setHint
Sets custom hint that should be used by the query. -
setHints
Sets custom hints that should be used by the query. -
getIdName
- Returns:
- name of property that represents an identifier of the returned KeyValueEntity, if set by
setIdName(String)
-
setIdName
Sets name of the property that represents an identifier of the returned KeyValueEntity. -
addProperty
Adds a key of a returned key-value pair. The sequence of adding properties must conform to the sequence of result fields in the query "select" clause.For example, if the query is
select e.id, e.name from sample$Customer
and you executedcontext.addProperty("customerId").addProperty("customerName")
, the returned KeyValueEntity will contain customer identifiers in "customerId" property and names in "customerName" property.- Returns:
- this instance for chaining
-
setProperties
The same as invokingaddProperty(String)
multiple times.- Returns:
- this instance for chaining
-
getProperties
- Returns:
- the list of properties added by
addProperty(String)
-
getAccessConstraints
-
setAccessConstraints
-
isJoinTransaction
public boolean isJoinTransaction() -
setJoinTransaction
-
toString
-