Package io.jmix.core

Class LoadContext.Query

java.lang.Object
io.jmix.core.LoadContext.Query
All Implemented Interfaces:
DataLoadContextQuery, Serializable
Enclosing class:
LoadContext<E>

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

    • Query

      protected Query()
    • 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 LoadContext.Query setQueryString(String queryString)
      Parameters:
      queryString - JPQL query string. Only named parameters are supported.
    • setParameter

      public LoadContext.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 LoadContext.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 LoadContext.Query setParameters(Map<String,Object> parameters)
      Specified by:
      setParameters in interface DataLoadContextQuery
      Parameters:
      parameters - map of the query parameters
    • setFirstResult

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

      public LoadContext.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 LoadContext.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 LoadContext.Query setSort(Sort sort)
      Parameters:
      sort - query sort
      Returns:
      this query instance for chaining
    • setCacheable

      public LoadContext.Query setCacheable(boolean cacheable)
      Indicates that the query results should be cached.
      Returns:
      the same query instance
    • 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
    • isCacheable

      public boolean isCacheable()
    • 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
    • copy

      public LoadContext.Query copy()
      Creates a copy of this Query instance.
    • copyStateTo

      public void copyStateTo(LoadContext.Query query)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object