Package net.sf.basedb.core
Class DynamicJoin
java.lang.Object
net.sf.basedb.core.DynamicJoin
- All Implemented Interfaces:
Join
,QueryElement
Represents a join between two virtual tables in a dynamic
query:
leftTable JOIN rightTable ON columns
.
This class is used by, for example, DynamicSpotQuery.joinReporters(JoinType)
to create the Join
query element that is needed.
- Version:
- 2.0
- Author:
- Nicklas
- Last modified
- $Date: 2012-09-14 09:28:35 +0200 (fr, 14 sep 2012) $
-
Field Summary
Modifier and TypeFieldDescriptionprivate int
private final JoinType
private final VirtualTable
private final VirtualColumn[]
private final VirtualTable
private final VirtualColumn[]
private final VirtualDb
-
Constructor Summary
ConstructorDescriptionDynamicJoin
(VirtualDb vdb, JoinType joinType, VirtualTable right, VirtualColumn... columns) Create a new join using the root entity table as the left table.DynamicJoin
(VirtualDb vdb, JoinType joinType, VirtualTable left, VirtualColumn[] leftColumns, VirtualTable right, VirtualColumn[] rightColumns) Create a new join between two tables with possible different colum names in the left and right tables.DynamicJoin
(VirtualDb vdb, JoinType joinType, VirtualTable left, VirtualTable right, VirtualColumn... columns) Create a new join between two tables. -
Method Summary
Modifier and TypeMethodDescriptionboolean
This join is equal to another DynamicJoin if they join between the same tables using the same columns and join types.Collection<? extends QueryElement>
Get the children of this query element or null if it has no children.getThetaJoin
(Query query, DbControl dc) getThetaJoinCondition
(Query query, DbControl dc) int
hashCode()
Create a query language string of the query element.toString()
-
Field Details
-
vdb
-
joinType
-
left
-
right
-
leftColumns
-
rightColumns
-
hashCode
private int hashCode
-
-
Constructor Details
-
DynamicJoin
DynamicJoin(VirtualDb vdb, JoinType joinType, VirtualTable right, VirtualColumn... columns) Create a new join using the root entity table as the left table.SELECT ... FROM rootTable JOIN right ON columns
.- Parameters:
vdb
- The virtual database where the joined table is locatedjoinType
- The type of joinright
- The table to join tocolumns
- The columns to join on, all columns must exists in the root table and the joined table
-
DynamicJoin
DynamicJoin(VirtualDb vdb, JoinType joinType, VirtualTable left, VirtualTable right, VirtualColumn... columns) Create a new join between two tables. The left table must already have been joined to the root table or to another joined table.SELECT ... FROM rootTable ... JOIN left ... JOIN right ON columns
- Parameters:
vdb
- The virtual database where the joined table is locatedjoinType
- The type of joinleft
- The table to join fromright
- The table to join tocolumns
- The columns to join on, all columns must exists in the left table and the right table
-
DynamicJoin
DynamicJoin(VirtualDb vdb, JoinType joinType, VirtualTable left, VirtualColumn[] leftColumns, VirtualTable right, VirtualColumn[] rightColumns) Create a new join between two tables with possible different colum names in the left and right tables.- Parameters:
vdb
- The virtual database where the joined table is locatedjoinType
- The type of joinleft
- The table to join from (or null to join from the root table)leftColumns
- The columns in the left table to use in the joinright
- The table to join torightColumns
- The columns in the right table (must be of same length as leftColumns)- Since:
- 3.1
-
-
Method Details
-
toQl
Description copied from interface:QueryElement
Create a query language string of the query element. Use theQuery.getQueryType()
method to find out which query language is wanted in case the element requires different syntax for different languages.- Specified by:
toQl
in interfaceQueryElement
- Parameters:
query
- The query that is about to be executeddc
- TheDbControl
object used to execute the query- Throws:
BaseException
- If there is any other error
-
getChildren
Description copied from interface:QueryElement
Get the children of this query element or null if it has no children. For example theAddExpression
has two children, the expression beeing added.- Specified by:
getChildren
in interfaceQueryElement
- Returns:
- Always null
-
getThetaJoin
- Specified by:
getThetaJoin
in interfaceJoin
- Throws:
BaseException
-
getThetaJoinCondition
- Specified by:
getThetaJoinCondition
in interfaceJoin
- Throws:
BaseException
-
toString
-
equals
This join is equal to another DynamicJoin if they join between the same tables using the same columns and join types. -
hashCode
public int hashCode()
-