类 JoinSequence


  • public class JoinSequence
    extends Object
    A sequence of JoinSequence.Join delegates to make it "easier" to work with joins. The "easier" part is obviously subjective ;)

    Additionally JoinSequence is a directed graph of other JoinSequence instances, as represented by the next (setNext(JoinSequence)) pointer.

    作者:
    Gavin King, Steve Ebersole
    另请参阅:
    JoinFragment
    • 构造器详细资料

      • JoinSequence

        public JoinSequence​(SessionFactoryImplementor factory)
        Constructs a JoinSequence
        参数:
        factory - The SessionFactory
    • 方法详细资料

      • getFromPart

        public JoinSequence getFromPart()
        Retrieve a JoinSequence that represents just the FROM clause parts
        返回:
        The JoinSequence that represents just the FROM clause parts
      • applyTreatAsDeclarations

        public void applyTreatAsDeclarations​(Set<String> treatAsDeclarations)
      • getTreatAsDeclarations

        protected Set<String> getTreatAsDeclarations()
      • copy

        public JoinSequence copy()
        Create a full, although shallow, copy.
        返回:
        The copy
      • addJoin

        public JoinSequence addJoin​(AssociationType associationType,
                                    String alias,
                                    JoinType joinType,
                                    String[] referencingKey)
                             throws MappingException
        Add a join to this sequence
        参数:
        associationType - The type of the association representing the join
        alias - The RHS alias for the join
        joinType - The type of join (INNER, etc)
        referencingKey - The LHS columns for the join condition
        返回:
        The Join memento
        抛出:
        MappingException - Generally indicates a problem resolving the associationType to a Joinable
      • addJoin

        public JoinSequence addJoin​(AssociationType associationType,
                                    String alias,
                                    JoinType joinType,
                                    String[][] referencingKeys)
                             throws MappingException
        Add a join to this sequence
        参数:
        associationType - The type of the association representing the join
        alias - The RHS alias for the join
        joinType - The type of join (INNER, etc)
        referencingKeys - The LHS columns for the join condition
        返回:
        The Join memento
        抛出:
        MappingException - Generally indicates a problem resolving the associationType to a Joinable
      • addJoin

        public JoinSequence addJoin​(ImpliedFromElement fromElement)
        Embeds an implied from element into this sequence
        参数:
        fromElement - The implied from element to embed
        返回:
        The Join memento
      • toJoinFragment

        public JoinFragment toJoinFragment()
                                    throws MappingException
        Generate a JoinFragment
        返回:
        The JoinFragment
        抛出:
        MappingException - Indicates a problem access the provided metadata, or incorrect metadata
      • toJoinFragment

        public JoinFragment toJoinFragment​(Map enabledFilters,
                                           boolean includeAllSubclassJoins)
                                    throws MappingException
        Generate a JoinFragment
        参数:
        enabledFilters - The filters associated with the originating session to properly define join conditions
        includeAllSubclassJoins - Should all subclass joins be added to the rendered JoinFragment?
        返回:
        The JoinFragment
        抛出:
        MappingException - Indicates a problem access the provided metadata, or incorrect metadata
      • toJoinFragment

        public JoinFragment toJoinFragment​(Map enabledFilters,
                                           boolean includeAllSubclassJoins,
                                           String withClauseFragment)
                                    throws MappingException
        Generate a JoinFragment
        参数:
        enabledFilters - The filters associated with the originating session to properly define join conditions
        includeAllSubclassJoins - Should all subclass joins be added to the rendered JoinFragment?
        withClauseFragment - The with clause (which represents additional join restrictions) fragment
        返回:
        The JoinFragment
        抛出:
        MappingException - Indicates a problem access the provided metadata, or incorrect metadata
      • isIncluded

        protected boolean isIncluded​(String alias)
      • addCondition

        public JoinSequence addCondition​(String condition)
        Add a condition to this sequence.
        参数:
        condition - The condition
        返回:
        {@link this}, for method chaining
      • addCondition

        public JoinSequence addCondition​(String alias,
                                         String[] columns,
                                         String condition)
        Add a condition to this sequence. Typical usage here might be:
             addCondition( "a", {"c1", "c2"}, "?" )
         
        to represent:
             "... a.c1 = ? and a.c2 = ? ..."
         
        参数:
        alias - The alias to apply to the columns
        columns - The columns to add checks for
        condition - The conditions to check against the columns
        返回:
        {@link this}, for method chaining
      • setRoot

        public JoinSequence setRoot​(Joinable joinable,
                                    String alias)
        Set the root of this JoinSequence. In SQL terms, this would be the driving table.
        参数:
        joinable - The entity/collection that is the root of this JoinSequence
        alias - The alias associated with that joinable.
        返回:
        {@link this}, for method chaining
      • setNext

        public JoinSequence setNext​(JoinSequence next)
        Sets the next join sequence
        参数:
        next - The next JoinSequence in the directed graph
        返回:
        this, for method chaining
      • setSelector

        public JoinSequence setSelector​(JoinSequence.Selector selector)
        Set the Selector to use to determine how subclass joins should be applied.
        参数:
        selector - The selector to apply
        返回:
        this, for method chaining
      • setUseThetaStyle

        public JoinSequence setUseThetaStyle​(boolean useThetaStyle)
        Should this JoinSequence use theta-style joining (both a FROM and WHERE component) in the rendered SQL?
        参数:
        useThetaStyle - true indicates that theta-style joins should be used.
        返回:
        this, for method chaining
      • isThetaStyle

        public boolean isThetaStyle()
      • setQueryReferencedTables

        public void setQueryReferencedTables​(Set<String> queryReferencedTables)
        Set all tables the query refers to. It allows to optimize the query.
        参数:
        queryReferencedTables -
      • copyForCollectionProperty

        public JoinSequence copyForCollectionProperty()