Class OrmQueryDetail

  • All Implemented Interfaces:
    Serializable

    public 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:
    Serialized Form
    • Method Detail

      • 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.
      • select

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

        public void setEmptyBase()
        Set the base query properties to be empty.
      • 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
      • 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.

      • 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.

      • includesPath

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