Package org.datanucleus.store.rdbms.sql
Class SQLJoin
- java.lang.Object
-
- org.datanucleus.store.rdbms.sql.SQLJoin
-
public class SQLJoin extends java.lang.ObjectRepresentation 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 classSQLJoin.JoinType
-
Field Summary
Fields Modifier and Type Field Description private BooleanExpressionconditionOptional condition for the join.private SQLTablesourceTableThe current table that we are joining from to introduce this table.private SQLJoinsubJoinOptional sub-join, for when we have JOIN grouping.private SQLTabletargetTableTable we are joining to.private SQLJoin.JoinTypetypeType 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 voidaddAndCondition(BooleanExpression expr)Method to update the join "condition" to AND the provided expression.BooleanExpressiongetCondition()Accessor for the conditions of the join.static SQLJoin.JoinTypegetJoinTypeForJoinExpressionType(org.datanucleus.store.query.expression.JoinExpression.JoinType ejt)SQLTablegetSourceTable()Accessor for the table we are joining from.SQLJoingetSubJoin()SQLTablegetTargetTable()Accessor for the table we are joining to.SQLJoin.JoinTypegetType()voidsetSubJoin(SQLJoin join)voidsetType(SQLJoin.JoinType type)SQLTexttoSQLText(DatastoreAdapter dba, boolean lock)java.lang.StringtoString()
-
-
-
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:
toStringin 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)
-
-