Package io.jmix.core

Class ValueLoadContext.Query

java.lang.Object
io.jmix.core.ValueLoadContext.Query
All Implemented Interfaces:
DataLoadContextQuery, Serializable
Enclosing class:
ValueLoadContext

public static class ValueLoadContext.Query extends Object implements DataLoadContextQuery, Serializable
Class that defines a query to be executed for loading values.
See Also:
  • Constructor Details

    • Query

      public Query(String queryString)
      Parameters:
      queryString - JPQL query string. Only named parameters are supported.
  • Method Details

    • getQueryString

      public String getQueryString()
      Returns:
      JPQL query string
    • setQueryString

      public void setQueryString(String queryString)
      Parameters:
      queryString - JPQL query string. Only named parameters are supported.
    • setParameter

      public ValueLoadContext.Query setParameter(String name, Object value)
      Set value for a query parameter.
      Specified by:
      setParameter in interface DataLoadContextQuery
      Parameters:
      name - parameter name
      value - parameter value
      Returns:
      this query instance for chaining
    • setParameter

      public ValueLoadContext.Query setParameter(String name, Object value, boolean implicitConversions)
      Set value for a query parameter.
      Parameters:
      name - parameter name
      value - parameter value
      implicitConversions - whether to do parameter value conversions, e.g. convert an entity to its ID
      Returns:
      this query instance for chaining
    • setParameter

      public ValueLoadContext.Query setParameter(String name, Date value, jakarta.persistence.TemporalType temporalType)
      Set value for a parameter of java.util.Date type.
      Specified by:
      setParameter in interface DataLoadContextQuery
      Parameters:
      name - parameter name
      value - date value
      temporalType - temporal type
      Returns:
      this query instance for chaining
    • getParameters

      public Map<String,Object> getParameters()
      Specified by:
      getParameters in interface DataLoadContextQuery
      Returns:
      editable map of the query parameters
    • setParameters

      public ValueLoadContext.Query setParameters(Map<String,Object> parameters)
      Specified by:
      setParameters in interface DataLoadContextQuery
      Parameters:
      parameters - map of the query parameters
    • setFirstResult

      public ValueLoadContext.Query setFirstResult(int firstResult)
      Specified by:
      setFirstResult in interface DataLoadContextQuery
      Parameters:
      firstResult - results offset
      Returns:
      this query instance for chaining
    • setMaxResults

      public ValueLoadContext.Query setMaxResults(int maxResults)
      Specified by:
      setMaxResults in interface DataLoadContextQuery
      Parameters:
      maxResults - results limit
      Returns:
      this query instance for chaining
    • getCondition

      public Condition getCondition()
      Specified by:
      getCondition in interface DataLoadContextQuery
      Returns:
      root query condition
    • setCondition

      public ValueLoadContext.Query setCondition(Condition condition)
      Specified by:
      setCondition in interface DataLoadContextQuery
      Parameters:
      condition - root query condition
      Returns:
      this query instance for chaining
    • getSort

      public Sort getSort()
      Returns:
      query sort
    • setSort

      public ValueLoadContext.Query setSort(Sort sort)
      Parameters:
      sort - query sort
      Returns:
      this query instance for chaining
    • getFirstResult

      public int getFirstResult()
      Specified by:
      getFirstResult in interface DataLoadContextQuery
      Returns:
      results offset
    • getMaxResults

      public int getMaxResults()
      Specified by:
      getMaxResults in interface DataLoadContextQuery
      Returns:
      results limit
    • isDistinct

      public boolean isDistinct()
      Returns:
      true if query result should contain only unique elements ('distinct' will be added to jpql query), false otherwise
    • setDistinct

      public void setDistinct(boolean distinct)
      Sets whether query result should contain only unique elements ('distinct' will be added to jpql query).
      Parameters:
      distinct - flag indicating whether query result should contain only unique elements
    • getNoConversionParams

      @Nullable public String[] getNoConversionParams()
    • toString

      public String toString()
      Overrides:
      toString in class Object