Class SQLJoin

java.lang.Object
org.datanucleus.store.rdbms.sql.SQLJoin

public class SQLJoin extends Object
Representation of a join in an SQL statement. The join is of a type (see ANSI SQL), and with inner/left outer/right outer is accompanied by join condition(s), joining from the source table to the target table via columns. Additionally other conditions can be applied to restrict the join (such as discriminator).
  • Field Details

    • type

      private SQLJoin.JoinType type
      Type of join to perform.
    • targetTable

      private SQLTable targetTable
      Table we are joining to. This is always set irrespective the type of join.
    • sourceTable

      private SQLTable sourceTable
      The current table that we are joining from to introduce this table.
    • condition

      private BooleanExpression condition
      Optional condition for the join.
    • subJoin

      private SQLJoin subJoin
      Optional sub-join, for when we have JOIN grouping.
  • Constructor Details

    • SQLJoin

      public SQLJoin(SQLJoin.JoinType type, SQLTable targetTbl, SQLTable sourceTbl, BooleanExpression condition)
      Constructor for a join.
      Parameters:
      type - Type of join (one of the defined types in this class).
      targetTbl - Target table that we are joining to
      sourceTbl - Table we are joining from
      condition - Join condition
  • Method Details

    • getType

      public SQLJoin.JoinType getType()
    • setType

      public void setType(SQLJoin.JoinType type)
    • getTargetTable

      public SQLTable getTargetTable()
      Accessor for the table we are joining to.
      Returns:
      The table joined to
    • getSourceTable

      public SQLTable getSourceTable()
      Accessor for the table we are joining from.
      Returns:
      The table we join from to bring in this other table
    • getCondition

      public BooleanExpression getCondition()
      Accessor for the conditions of the join. These conditions can include
      Returns:
      The conditions
    • addAndCondition

      public void addAndCondition(BooleanExpression expr)
      Method to update the join "condition" to AND the provided expression.
      Parameters:
      expr - The expression to add to the join "condition"
    • setSubJoin

      public void setSubJoin(SQLJoin join)
    • getSubJoin

      public SQLJoin getSubJoin()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toSQLText

      public SQLText toSQLText(DatastoreAdapter dba, boolean lock)
    • getJoinTypeForJoinExpressionType

      public static SQLJoin.JoinType getJoinTypeForJoinExpressionType(org.datanucleus.store.query.expression.JoinExpression.JoinType ejt)