Class DefaultDtoQuery<T>

java.lang.Object
io.ebeaninternal.server.querydefn.AbstractQuery
io.ebeaninternal.server.querydefn.DefaultDtoQuery<T>
All Implemented Interfaces:
io.ebean.CancelableQuery, io.ebean.DtoQuery<T>, SpiCancelableQuery, SpiDtoQuery<T>, SpiSqlBinding

@NullMarked public final class DefaultDtoQuery<T> extends AbstractQuery implements SpiDtoQuery<T>
Default implementation of DtoQuery.
  • Constructor Details

    • DefaultDtoQuery

      public DefaultDtoQuery(SpiEbeanServer server, io.ebeaninternal.server.dto.DtoBeanDescriptor<T> descriptor, SpiQuery<?> ormQuery)
      Create given an underlying ORM query.
    • DefaultDtoQuery

      public DefaultDtoQuery(SpiEbeanServer server, io.ebeaninternal.server.dto.DtoBeanDescriptor<T> descriptor, String sql)
      Create given a native SQL query.
  • Method Details

    • planKey

      public String planKey()
      Description copied from interface: SpiDtoQuery
      Return the key for query plan.
      Specified by:
      planKey in interface SpiDtoQuery<T>
    • queryPlan

      public io.ebeaninternal.server.dto.DtoQueryPlan queryPlan(Object planKey)
      Description copied from interface: SpiDtoQuery
      Get the query plan for the cache.
      Specified by:
      queryPlan in interface SpiDtoQuery<T>
    • buildPlan

      public io.ebeaninternal.server.dto.DtoQueryPlan buildPlan(io.ebeaninternal.server.dto.DtoMappingRequest request)
      Description copied from interface: SpiDtoQuery
      Build the query plan.
      Specified by:
      buildPlan in interface SpiDtoQuery<T>
    • putQueryPlan

      public void putQueryPlan(Object planKey, io.ebeaninternal.server.dto.DtoQueryPlan plan)
      Description copied from interface: SpiDtoQuery
      Put the query plan into the cache.
      Specified by:
      putQueryPlan in interface SpiDtoQuery<T>
    • usingTransaction

      public io.ebean.DtoQuery<T> usingTransaction(io.ebean.Transaction transaction)
      Specified by:
      usingTransaction in interface io.ebean.DtoQuery<T>
    • usingConnection

      public io.ebean.DtoQuery<T> usingConnection(Connection connection)
      Specified by:
      usingConnection in interface io.ebean.DtoQuery<T>
    • usingMaster

      public io.ebean.DtoQuery<T> usingMaster(boolean useMaster)
      Specified by:
      usingMaster in interface io.ebean.DtoQuery<T>
    • isUseMaster

      public boolean isUseMaster()
      Description copied from interface: SpiSqlBinding
      Return true if this query should not use the read only data source.
      Specified by:
      isUseMaster in interface SpiSqlBinding
    • findEach

      public void findEach(Consumer<T> consumer)
      Specified by:
      findEach in interface io.ebean.DtoQuery<T>
    • findEach

      public void findEach(int batch, Consumer<List<T>> consumer)
      Specified by:
      findEach in interface io.ebean.DtoQuery<T>
    • findEachWhile

      public void findEachWhile(Predicate<T> consumer)
      Specified by:
      findEachWhile in interface io.ebean.DtoQuery<T>
    • findIterate

      public io.ebean.QueryIterator<T> findIterate()
      Specified by:
      findIterate in interface io.ebean.DtoQuery<T>
    • findStream

      public Stream<T> findStream()
      Specified by:
      findStream in interface io.ebean.DtoQuery<T>
    • findList

      public List<T> findList()
      Specified by:
      findList in interface io.ebean.DtoQuery<T>
    • findOne

      @Nullable public T findOne()
      Specified by:
      findOne in interface io.ebean.DtoQuery<T>
    • findOneOrEmpty

      public Optional<T> findOneOrEmpty()
      Specified by:
      findOneOrEmpty in interface io.ebean.DtoQuery<T>
    • setNullParameter

      public io.ebean.DtoQuery<T> setNullParameter(String name, int jdbcType)
      Specified by:
      setNullParameter in interface io.ebean.DtoQuery<T>
    • setNullParameter

      public io.ebean.DtoQuery<T> setNullParameter(int position, int jdbcType)
      Specified by:
      setNullParameter in interface io.ebean.DtoQuery<T>
    • setParameter

      public io.ebean.DtoQuery<T> setParameter(int position, Object value)
      Specified by:
      setParameter in interface io.ebean.DtoQuery<T>
    • setParameter

      public io.ebean.DtoQuery<T> setParameter(String paramName, Object value)
      Specified by:
      setParameter in interface io.ebean.DtoQuery<T>
    • setArrayParameter

      public io.ebean.DtoQuery<T> setArrayParameter(String paramName, Collection<?> values)
      Specified by:
      setArrayParameter in interface io.ebean.DtoQuery<T>
    • setParameters

      public io.ebean.DtoQuery<T> setParameters(Object... values)
      Specified by:
      setParameters in interface io.ebean.DtoQuery<T>
    • setParameter

      public io.ebean.DtoQuery<T> setParameter(Object value)
      Specified by:
      setParameter in interface io.ebean.DtoQuery<T>
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • type

      public Class<T> type()
      Description copied from interface: SpiDtoQuery
      Return the associated DTO bean type.
      Specified by:
      type in interface SpiDtoQuery<T>
    • ormQuery

      public SpiQuery<?> ormQuery()
      Description copied from interface: SpiDtoQuery
      Return an underlying ORM query (if this query is built from an ORM query).
      Specified by:
      ormQuery in interface SpiDtoQuery<T>
    • transaction

      public SpiTransaction transaction()
      Description copied from interface: SpiSqlBinding
      Return the transaction explicitly associated to the query.
      Specified by:
      transaction in interface SpiSqlBinding
    • setRelaxedMode

      public io.ebean.DtoQuery<T> setRelaxedMode()
      Specified by:
      setRelaxedMode in interface io.ebean.DtoQuery<T>
    • isRelaxedMode

      public boolean isRelaxedMode()
      Description copied from interface: SpiDtoQuery
      Return true if the query is in relaxed mapping mode.
      Specified by:
      isRelaxedMode in interface SpiDtoQuery<T>
    • setLabel

      public io.ebean.DtoQuery<T> setLabel(String label)
      Specified by:
      setLabel in interface io.ebean.DtoQuery<T>
    • getLabel

      public String getLabel()
      Description copied from interface: SpiSqlBinding
      Return the label (to collect metrics on when set).
      Specified by:
      getLabel in interface SpiSqlBinding
    • planLabel

      @Nullable public String planLabel()
      Description copied from interface: SpiDtoQuery
      Return the label with fallback to profile location label.
      Specified by:
      planLabel in interface SpiDtoQuery<T>
    • obtainLocation

      public void obtainLocation()
      Description copied from interface: SpiDtoQuery
      Obtain the location if necessary.
      Specified by:
      obtainLocation in interface SpiDtoQuery<T>
    • setProfileLocation

      public io.ebean.DtoQuery<T> setProfileLocation(io.ebean.ProfileLocation profileLocation)
      Specified by:
      setProfileLocation in interface io.ebean.DtoQuery<T>
    • profileLocation

      public io.ebean.ProfileLocation profileLocation()
      Description copied from interface: SpiDtoQuery
      Return the profile location.
      Specified by:
      profileLocation in interface SpiDtoQuery<T>
    • getFirstRow

      public int getFirstRow()
      Description copied from interface: SpiSqlBinding
      Return the first row to fetch.
      Specified by:
      getFirstRow in interface SpiSqlBinding
    • setFirstRow

      public io.ebean.DtoQuery<T> setFirstRow(int firstRow)
      Specified by:
      setFirstRow in interface io.ebean.DtoQuery<T>
    • getMaxRows

      public int getMaxRows()
      Description copied from interface: SpiSqlBinding
      Return the maximum number of rows to fetch.
      Specified by:
      getMaxRows in interface SpiSqlBinding
    • setMaxRows

      public io.ebean.DtoQuery<T> setMaxRows(int maxRows)
      Specified by:
      setMaxRows in interface io.ebean.DtoQuery<T>
    • getTimeout

      public int getTimeout()
      Description copied from interface: SpiSqlBinding
      Return the query timeout.
      Specified by:
      getTimeout in interface SpiSqlBinding
    • setTimeout

      public io.ebean.DtoQuery<T> setTimeout(int secs)
      Specified by:
      setTimeout in interface io.ebean.DtoQuery<T>
    • getBindParams

      public BindParams getBindParams()
      Description copied from interface: SpiSqlBinding
      Return the named or positioned parameters.
      Specified by:
      getBindParams in interface SpiSqlBinding
    • setDefaultFetchBuffer

      public void setDefaultFetchBuffer(int fetchSize)
      Description copied from interface: SpiSqlBinding
      Set the JDBC fetchSize buffer hint if not explicitly set.
      Specified by:
      setDefaultFetchBuffer in interface SpiSqlBinding
    • setBufferFetchSizeHint

      public io.ebean.DtoQuery<T> setBufferFetchSizeHint(int bufferFetchSizeHint)
      Specified by:
      setBufferFetchSizeHint in interface io.ebean.DtoQuery<T>
    • getBufferFetchSizeHint

      public int getBufferFetchSizeHint()
      Description copied from interface: SpiSqlBinding
      Return the hint for Statement.setFetchSize().
      Specified by:
      getBufferFetchSizeHint in interface SpiSqlBinding
    • getQuery

      public String getQuery()
      Description copied from interface: SpiSqlBinding
      return the query.
      Specified by:
      getQuery in interface SpiSqlBinding