Class DefaultMappedQuery<T,D>

java.lang.Object
io.ebeaninternal.server.querydefn.DefaultMappedQuery<T,D>
All Implemented Interfaces:
io.ebean.MappedQuery<D>

public final class DefaultMappedQuery<T,D> extends Object implements io.ebean.MappedQuery<D>
Default implementation of MappedQuery backing query.mapTo(dtoType).

Resolves the generated DtoMapper for the query's (entity, dto) pair, applies its DtoMapper.fetchGroup() (derived from the target DTO's declared shape) - unless the caller has already specified their own select()/fetch() spec, in which case that manual spec is left untouched - and forces setUnmodifiable(true) on the underlying query before it is executed, then maps the resulting entity graph into the target DTO graph.

  • Constructor Details

    • DefaultMappedQuery

      public DefaultMappedQuery(SpiEbeanServer server, SpiQuery<T> query, Class<D> dtoType)
    • DefaultMappedQuery

      public DefaultMappedQuery(SpiEbeanServer server, SpiQuery<T> query, Class<D> dtoType, io.ebean.DtoMapper<T,D> mapper)
      Use an already-resolved mapper instance directly - e.g. a named variant accessor on a generated mapper, such as query.mapTo(User.class, userMapper.noFleets()) - bypassing server.dtoMapper(...) lookup entirely.
  • Method Details

    • findList

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

      public D findOne()
      Specified by:
      findOne in interface io.ebean.MappedQuery<T>
    • findOneOrEmpty

      public Optional<D> findOneOrEmpty()
      Specified by:
      findOneOrEmpty in interface io.ebean.MappedQuery<T>
    • findOneOrThrow

      public D findOneOrThrow()
      Specified by:
      findOneOrThrow in interface io.ebean.MappedQuery<T>
    • findPagedList

      public io.ebean.PagedList<D> findPagedList()
      Specified by:
      findPagedList in interface io.ebean.MappedQuery<T>
    • findStream

      public Stream<D> findStream()
      Specified by:
      findStream in interface io.ebean.MappedQuery<T>
    • usingMaster

      public io.ebean.MappedQuery<D> usingMaster(boolean useMaster)
      Specified by:
      usingMaster in interface io.ebean.MappedQuery<T>
    • usingTransaction

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

      public io.ebean.MappedQuery<D> usingConnection(Connection connection)
      Specified by:
      usingConnection in interface io.ebean.MappedQuery<T>