Class OrmQueryDetail

java.lang.Object
io.ebeaninternal.server.querydefn.OrmQueryDetail
All Implemented Interfaces:
Serializable

public final class OrmQueryDetail extends Object implements Serializable
Represents the internal structure of an Object Relational query.

Holds the select() and join() details of a ORM query.

It is worth noting that for AutoTune a "tuned fetch info" builds an instance of OrmQueryDetail. Tuning a query is a matter of replacing an instance of this class with one that has been tuned with select() and join() set.

See Also:
  • Constructor Details

    • OrmQueryDetail

      public OrmQueryDetail()
  • Method Details

    • copy

      public OrmQueryDetail copy()
      Return a deep copy of the OrmQueryDetail.
    • addNested

      public void addNested(String path, OrmQueryDetail other, FetchConfig config)
      Add a nested OrmQueryDetail to this detail.
    • queryPlanHash

      public void queryPlanHash(StringBuilder builder)
      Calculate the hash for the query plan.
    • isAutoTuneEqual

      public boolean isAutoTuneEqual(OrmQueryDetail otherDetail)
      Return true if equal in terms of autoTune (select and fetch without property ordering).
    • asString

      public String asString()
      Return the detail in string form.
    • hashCode

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

      public void select(String properties)
      set the properties to include on the base / root entity.
    • selectProperties

      public void selectProperties(Set<String> properties)
      Set select properties that are already parsed.
    • setEmptyBase

      public void setEmptyBase()
      Set the base query properties to be empty.
    • setBase

      public void setBase(OrmQueryProperties baseProps)
      Set the base / root query properties.
    • clear

      public void clear()
      Remove all joins and properties. Typically for the row count query.
    • fetch

      public void fetch(String path, String partialProps, FetchConfig fetchConfig)
      Set the fetch properties and configuration for a given path.
      Parameters:
      path - the property to join
      partialProps - the properties on the join property to include
    • fetchProperties

      public void fetchProperties(String path, Set<String> properties, FetchConfig fetchConfig)
      Set fetch properties that are already parsed.
    • fetch

      public void fetch(String path, LinkedHashSet<String> properties)
      Add for raw sql etc when the properties are already parsed into a set.
    • sortFetchPaths

      public void sortFetchPaths(BeanDescriptor<?> d)
      Sort the fetch paths into depth order adding any missing parent paths if necessary.
    • setDefaultSelectClause

      public void setDefaultSelectClause(BeanDescriptor<?> desc)
      Set any default select clauses for the main bean and any joins that have not explicitly defined a select clause.

      That is this will use FetchType.LAZY to exclude some properties by default.

    • hasSelectClause

      public boolean hasSelectClause()
    • isEmpty

      public boolean isEmpty()
      Return true if the query detail has neither select properties specified or any joins defined.
    • isJoinsEmpty

      public boolean isJoinsEmpty()
      Return true if there are no joins.
    • includeBeanJoin

      public void includeBeanJoin(String parentPath, String propertyName)
      Add the explicit bean join.

      This is also used to Exclude the matching property from the parent select (aka remove the foreign key) because it is now included in it's on node in the SqlTree.

    • getChunk

      public OrmQueryProperties getChunk(String path, boolean create)
    • includesPath

      public boolean includesPath(String path)
      Return true if the fetch path is included.
    • getFetchPaths

      public Set<String> getFetchPaths()
      Return the fetch paths for this detail.
    • entries

      public Set<Map.Entry<String,OrmQueryProperties>> entries()
      Return the underlying fetch path entries.
    • prepareExpressions

      public void prepareExpressions(BeanQueryRequest<?> request)
      Prepare filterMany expressions that are being included into the main query.