Package org.datanucleus.store.rdbms.sql
Class SQLJoin
- java.lang.Object
-
- org.datanucleus.store.rdbms.sql.SQLJoin
-
public class SQLJoin extends java.lang.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).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SQLJoin.JoinType
-
Field Summary
Fields Modifier and Type Field Description private BooleanExpression
condition
Optional condition for the join.private SQLTable
sourceTable
The current table that we are joining from to introduce this table.private SQLJoin
subJoin
Optional sub-join, for when we have JOIN grouping.private SQLTable
targetTable
Table we are joining to.private SQLJoin.JoinType
type
Type of join to perform.
-
Constructor Summary
Constructors Constructor Description SQLJoin(SQLJoin.JoinType type, SQLTable targetTbl, SQLTable sourceTbl, BooleanExpression condition)
Constructor for a join.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAndCondition(BooleanExpression expr)
Method to update the join "condition" to AND the provided expression.BooleanExpression
getCondition()
Accessor for the conditions of the join.static SQLJoin.JoinType
getJoinTypeForJoinExpressionType(org.datanucleus.store.query.expression.JoinExpression.JoinType ejt)
SQLTable
getSourceTable()
Accessor for the table we are joining from.SQLJoin
getSubJoin()
SQLTable
getTargetTable()
Accessor for the table we are joining to.SQLJoin.JoinType
getType()
void
setSubJoin(SQLJoin join)
void
setType(SQLJoin.JoinType type)
SQLText
toSQLText(DatastoreAdapter dba, boolean lock)
java.lang.String
toString()
-
-
-
Field Detail
-
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 Detail
-
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 tosourceTbl
- Table we are joining fromcondition
- Join condition
-
-
Method Detail
-
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 java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
toSQLText
public SQLText toSQLText(DatastoreAdapter dba, boolean lock)
-
getJoinTypeForJoinExpressionType
public static SQLJoin.JoinType getJoinTypeForJoinExpressionType(org.datanucleus.store.query.expression.JoinExpression.JoinType ejt)
-
-