Package net.sf.basedb.core
Class DynamicJoin
java.lang.Object
net.sf.basedb.core.DynamicJoin
- All Implemented Interfaces:
Join
,QueryElement
class DynamicJoin extends Object implements Join
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
Fields Modifier and Type Field Description private int
hashCode
private JoinType
joinType
private VirtualTable
left
private VirtualColumn[]
leftColumns
private VirtualTable
right
private VirtualColumn[]
rightColumns
private VirtualDb
vdb
-
Constructor Summary
Constructors Constructor Description DynamicJoin(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 Type Method Description boolean
equals(Object other)
This join is equal to another DynamicJoin if they join between the same tables using the same columns and join types.Collection<? extends QueryElement>
getChildren()
Get the children of this query element or null if it has no children.String
getThetaJoin(Query query, DbControl dc)
String
getThetaJoinCondition(Query query, DbControl dc)
int
hashCode()
String
toQl(Query query, DbControl dc)
Create a query language string of the query element.String
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()
-