Class HQLQuery

java.lang.Object
com.atlassian.crowd.search.hibernate.HQLQuery

public class HQLQuery extends Object
  • Field Details

    • select

      protected final StringBuilder select
    • from

      protected final StringBuilder from
    • where

      protected final StringBuilder where
    • orderBy

      protected final StringBuilder orderBy
    • aliasCounter

      protected int aliasCounter
    • cacheRegion

      protected String cacheRegion
    • distinctRequired

      protected boolean distinctRequired
    • whereRequired

      protected boolean whereRequired
    • orderByRequired

      protected boolean orderByRequired
    • readOnly

      protected boolean readOnly
    • parameterValues

      protected final Map<String,Object> parameterValues
    • maxResults

      protected int maxResults
    • startIndex

      protected int startIndex
    • fetchSize

      protected Integer fetchSize
    • batchedParam

      protected String batchedParam
    • comparatorForBatch

      protected Comparator comparatorForBatch
    • resultTransform

      protected Function<List<Object[]>,List<?>> resultTransform
  • Constructor Details

    • HQLQuery

      public HQLQuery()
  • Method Details

    • appendSelect

      public StringBuilder appendSelect(CharSequence hql)
    • appendFrom

      public StringBuilder appendFrom(CharSequence hql)
    • appendWhere

      @Deprecated public StringBuilder appendWhere(CharSequence hql)
      Deprecated.
      use safeAppendWhere instead
      Parameters:
      hql - the text to append to the where clause
      Returns:
      the stringbuilder representing the where clause
    • safeAppendWhere

      public HQLQuery safeAppendWhere(CharSequence hql)
    • appendOrderBy

      public StringBuilder appendOrderBy(CharSequence hql)
    • getNextAlias

      public int getNextAlias()
    • addParameterPlaceholder

      public String addParameterPlaceholder(@Nullable Object value)
      Creates a variable placeholder for a parameter
      Parameters:
      value - actual value of the parameter, or null if the parameter is to be ignored
      Returns:
      the JPA-style named variable (:param1, :param2, ...)
    • addParameterPlaceholderForBatchedParam

      public String addParameterPlaceholderForBatchedParam(@Nullable Collection values)
      Creates a variable placeholder for a parameter. Marks the parameter as batched; the name and the values of the parameter may be retrieved using getBatchedParamName() and getBatchedParamValues(). Only one parameter can be batched.
      Parameters:
      values - values of the parameter that need to be batched
      Returns:
      the JPA-style named variable (:param1, :param2, ...)
    • getComparatorForBatch

      public Comparator getComparatorForBatch()
      Returns:
      comparator to merge results of batched query
    • setComparatorForBatch

      public void setComparatorForBatch(Comparator comparatorForBatch)
      sets comparator to merge results of batched query
    • getParameterMap

      public Map<String,Object> getParameterMap()
      Returns:
      a list of parameter values. May contain null elements for parameters that are to be ignored
    • getParameterValues

      public Collection<Object> getParameterValues()
    • setFetchSize

      public void setFetchSize(@Nullable Integer fetchSize)
    • requireDistinct

      public void requireDistinct()
    • limitResults

      public void limitResults(int maxResults)
    • offsetResults

      public void offsetResults(int startIndex)
    • getFetchSize

      @Nonnull public Optional<Integer> getFetchSize()
    • getMaxResults

      public int getMaxResults()
    • getStartIndex

      public int getStartIndex()
    • isReadOnly

      public boolean isReadOnly()
    • setReadOnly

      public void setReadOnly(boolean readOnly)
    • getBatchedParamName

      public String getBatchedParamName()
      Returns name of the multi-valued parameter that should be split into batches.
    • getBatchedParamValues

      public Collection getBatchedParamValues()
      Returns values of the multi-valued parameter that should be split into batches.
    • setResultTransform

      public void setResultTransform(Function<List<Object[]>,List<?>> resultTransform)
    • getResultTransform

      public Function<List<Object[]>,List<?>> getResultTransform()
    • getCacheRegion

      public String getCacheRegion()
    • setCacheRegion

      public void setCacheRegion(String cacheRegion)
    • toString

      public String toString()
      Overrides:
      toString in class Object