Class CQuery<T>

java.lang.Object
io.ebeaninternal.server.query.CQuery<T>
All Implemented Interfaces:
io.ebean.CancelableQuery, SpiProfileTransactionEvent, DbReadContext

public final class CQuery<T> extends Object implements DbReadContext, io.ebean.CancelableQuery, SpiProfileTransactionEvent
An object that represents a SqlSelect statement.

The SqlSelect is based on a tree (Object Graph). The tree is traversed to see what parts are included in the tree according to the value of find.getInclude();

The tree structure is flattened into a SqlSelectChain. The SqlSelectChain is the key object used in reading the flat resultSet back into Objects.

  • Constructor Details

  • Method Details

    • isLoadContextBean

      public boolean isLoadContextBean()
      Description copied from interface: DbReadContext
      Return true if the beans that already exist in the persistence context should have data from the database loaded into them.

      This is the case for REFRESH and forUpdate queries.

      Specified by:
      isLoadContextBean in interface DbReadContext
    • isDisableLazyLoading

      public boolean isDisableLazyLoading()
      Description copied from interface: DbReadContext
      Return true if this request disables lazy loading.
      Specified by:
      isDisableLazyLoading in interface DbReadContext
    • unmodifiable

      public boolean unmodifiable()
      Description copied from interface: DbReadContext
      Return true if we are loading unmodifiable beans.
      Specified by:
      unmodifiable in interface DbReadContext
    • dataReader

      public io.ebean.core.type.DataReader dataReader()
      Description copied from interface: DbReadContext
      Return the DataReader.
      Specified by:
      dataReader in interface DbReadContext
    • queryMode

      public SpiQuery.Mode queryMode()
      Description copied from interface: DbReadContext
      Return the query mode.
      Specified by:
      queryMode in interface DbReadContext
    • predicates

      public CQueryPredicates predicates()
    • cancel

      public void cancel()
      Specified by:
      cancel in interface io.ebean.CancelableQuery
    • close

      public void close()
      Close the resources.

      The JDBC resultSet and statement need to be closed. Its important that this method is called.

    • persistenceContext

      public io.ebean.bean.PersistenceContext persistenceContext()
      Return the persistence context.
      Specified by:
      persistenceContext in interface DbReadContext
    • setLazyLoadedChildBean

      public void setLazyLoadedChildBean(io.ebean.bean.EntityBean bean, Object lazyLoadParentId)
      Description copied from interface: DbReadContext
      Set back the bean that has just been loaded with its id.
      Specified by:
      setLazyLoadedChildBean in interface DbReadContext
    • profile

      public void profile()
      Description copied from interface: SpiProfileTransactionEvent
      Add the event information to the profiling transaction.
      Specified by:
      profile in interface SpiProfileTransactionEvent
    • registerBeanInherit

      public void registerBeanInherit(BeanPropertyAssocOne<?> property, io.ebean.bean.EntityBeanIntercept ebi)
      Description copied from interface: DbReadContext
      Register a reference with inheritance for lazy loading.
      Specified by:
      registerBeanInherit in interface DbReadContext
    • register

      public void register(String path, io.ebean.bean.EntityBeanIntercept ebi)
      Description copied from interface: DbReadContext
      Register a reference for lazy loading.
      Specified by:
      register in interface DbReadContext
    • register

      public void register(BeanPropertyAssocMany<?> many, io.ebean.bean.BeanCollection<?> bc)
      Description copied from interface: DbReadContext
      Register a collection for lazy loading.
      Specified by:
      register in interface DbReadContext
    • includeSecondary

      public boolean includeSecondary(BeanPropertyAssocMany<?> many)
      Description copied from interface: DbReadContext
      Return true if this many property should be included in unmodifiable query via a secondary query.
      Specified by:
      includeSecondary in interface DbReadContext
    • isRawSql

      public boolean isRawSql()
      Return true if this is a raw sql query as opposed to Ebean generated sql.
      Specified by:
      isRawSql in interface DbReadContext
    • bindLog

      public String bindLog()
    • transaction

      public SpiTransaction transaction()
    • generatedSql

      public String generatedSql()
      Return the generated sql.
    • isAutoTuneProfiling

      public boolean isAutoTuneProfiling()
      Should we create profileNodes for beans created in this query.

      This is true for all queries except lazy load bean queries.

      Specified by:
      isAutoTuneProfiling in interface DbReadContext
    • profileBean

      public void profileBean(io.ebean.bean.EntityBeanIntercept ebi, String prefix)
      Description copied from interface: DbReadContext
      Add AutoTune profiling for a loaded entity bean.
      Specified by:
      profileBean in interface DbReadContext
    • setCurrentPrefix

      public void setCurrentPrefix(String currentPrefix, Map<String,String> currentPathMap)
      Description copied from interface: DbReadContext
      Set the JoinNode - used by proxy/reference beans for profiling.
      Specified by:
      setCurrentPrefix in interface DbReadContext
    • handleLoadError

      public void handleLoadError(String fullName, Exception e)
      Description copied from interface: DbReadContext
      Handles a load error on given property.
      Specified by:
      handleLoadError in interface DbReadContext
    • dependentTables

      public Set<String> dependentTables()