Class Join

  • All Implemented Interfaces:
    Serializable

    public class Join
    extends Object
    implements Serializable
    Data object to describe a join between two tables, for example
     table_a LEFT JOIN table_b ON table_a.id = table_b.a_id
     
    See Also:
    Serialized Form
    • Constructor Detail

      • Join

        public Join​(Column leftColumn,
                    Column rightColumn,
                    SqlEnum comparison,
                    JoinType joinType)
        Constructor with the comparison operator.
        Parameters:
        leftColumn - the left column of the join condition; might contain an alias name, not null.
        rightColumn - the right column of the join condition might contain an alias name, not null.
        comparison - the comparison, not null. The operator CUSTOM is not supported.
        joinType - the type of the join, or null (adding the join condition to the where clause).
        Throws:
        NullPointerException - if leftColumn, comparison or rightColumn are null.
        IllegalArgumentException - if comparison id SqlEnum.CUSTOM
      • Join

        public Join​(PreparedStatementPart leftTable,
                    PreparedStatementPart rightTable,
                    Criterion joinCondition,
                    JoinType joinType)
        Constructor.
        Parameters:
        leftTable - the left table of the join, might contain an alias name, or null to be determined from the join clause.
        rightTable - the right table of the join, might contain an alias name, or null to be determined from the join clause.
        joinCondition - the join condition, not null.
        joinType - the type of the join, or null (adding the join condition to the where clause).
    • Method Detail

      • getJoinCondition

        public final Criterion getJoinCondition()
        Returns:
        the type of the join, i.e. SqlEnum.LEFT_JOIN, ..., or null for adding the join condition to the where Clause
      • getJoinType

        public final JoinType getJoinType()
        Returns:
        the type of the join, i.e. SqlEnum.LEFT_JOIN, ..., or null for adding the join condition to the where Clause
      • getLeftTable

        public final PreparedStatementPart getLeftTable()
        Returns:
        the left table of the join condition.
      • getRightTable

        public final PreparedStatementPart getRightTable()
        Returns:
        the right table of the join condition.
      • toString

        public String toString()
        Returns a String representation of the class, mainly for debugging purposes.
        Overrides:
        toString in class Object
        Returns:
        a String representation of the class
      • equals

        public boolean equals​(Object obj)
        This method checks another Criteria.Join to see if they contain the same attributes.
        Overrides:
        equals in class Object
      • hashCode

        public int hashCode()
        Returns the hash code value for this Join.
        Overrides:
        hashCode in class Object
        Returns:
        a hash code value for this object.