Top Description Fields Constructors Methods
org.hibernate.sql

public abstract Class JoinFragment

extends Object
Class Inheritance
Known Direct Subclasses
org.hibernate.sql.OracleJoinFragment, org.hibernate.sql.QueryJoinFragment, org.hibernate.sql.Sybase11JoinFragment, org.hibernate.hql.internal.ast.tree.EntityJoinFromElement.EntityJoinJoinFragment, org.hibernate.sql.ANSIJoinFragment
Imports
org.hibernate.internal.util.StringHelper

An abstract SQL join fragment renderer
Author
Gavin King

Field Summary

Modifier and TypeField and Description
public static final int
FULL_JOIN

Specifies a full join

private boolean
private boolean
public static final int
INNER_JOIN

Specifies an inner join.

public static final int
LEFT_OUTER_JOIN

Specifies a left join.

public static final int
RIGHT_OUTER_JOIN

Specifies a right join.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public abstract void
addCondition(String
The alias of the joined table
alias
,
String[]
The names of the columns which reference the joined table
fkColumns
,
String[]
The columns in the joined table being referenced
pkColumns
)

Adds a condition to the join fragment.

public abstract boolean

Returns:

true if the condition was added
addCondition
(String
The fragment
condition
)

Adds a free-form condition fragment

protected boolean

Returns:

Returns true if the condition was added, false if the condition was already in 'on' string.
addCondition
(StringBuilder
The buffer to append the 'on' condition to.
buffer
,
String
The 'on' condition.
on
)

Appends the 'on' condition to the buffer, returning true if the condition was added.

public abstract void
addCrossJoin(String
The name of the table to be joined
tableName
,
String
The alias to apply to the joined table
alias
)

Adds a cross join to the specified table.

public void
addFragment(JoinFragment
The other join fragment
ojf
)

Adds another join fragment to this one.

public abstract void
addJoin(String
The name of the table to be joined
tableName
,
String
The alias to apply to the joined table
alias
,
String[]
The names of the columns which reference the joined table
fkColumns
,
String[]
The columns in the joined table being referenced
pkColumns
,
JoinType
The type of join
joinType
)

Adds a join.

public abstract void
addJoin(String
The name of the table to be joined
tableName
,
String
The alias to apply to the joined table
alias
,
String[]
The names of the columns which reference the joined table
fkColumns
,
String[]
The columns in the joined table being referenced
pkColumns
,
JoinType
The type of join
joinType
,
String
The additional ON fragment
on
)

Adds a join, with an additional ON clause fragment

public void
addJoin(String
The name of the table to be joined
tableName
,
String
The alias to apply to the joined table
alias
,
String[][]
The names of the columns which reference the joined table
fkColumns
,
String[]
The columns in the joined table being referenced
pkColumns
,
JoinType
The type of join
joinType
,
String
The additional ON fragment
on
)

Adds a join, with an additional ON clause fragment

public abstract void
addJoins(String
The FROM clause fragment
fromFragment
,
String
The WHERE clause fragment
whereFragment
)

Free-form form of adding theta-style joins taking the necessary FROM and WHERE clause fragments

public abstract JoinFragment

Returns:

The copy.
copy
()

Make a copy.

public boolean

Returns:

True if the where fragment is from a filter condition.
hasFilterCondition
()

True if the where fragment is from a filter condition.

public boolean

Returns:

true if the fragment contained theta joins
hasThetaJoins
()

Determine if the join fragment contained any theta-joins.

public void
public void
setHasThetaJoins(boolean hasThetaJoins)

public abstract String

Returns:

The FROM clause portion of this fragment
toFromFragmentString
()

Render this fragment to its FROM clause portion

public abstract String

Returns:

The WHERE clause portion of this fragment
toWhereFragmentString
()

Render this fragment to its WHERE clause portion

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

FULL_JOINback to summary
public static final int FULL_JOIN

Deprecated

use JoinType#FULL_JOIN instead.

Specifies a full join

Annotations
@Deprecated
@SuppressWarnings:UnusedDeclaration
hasFilterConditionback to summary
private boolean hasFilterCondition
hasThetaJoinsback to summary
private boolean hasThetaJoins
INNER_JOINback to summary
public static final int INNER_JOIN

Deprecated

use JoinType#INNER_JOIN instead.

Specifies an inner join.

Annotations
@Deprecated
LEFT_OUTER_JOINback to summary
public static final int LEFT_OUTER_JOIN

Deprecated

use JoinType#LEFT_OUTER_JOIN instead.

Specifies a left join.

Annotations
@Deprecated
RIGHT_OUTER_JOINback to summary
public static final int RIGHT_OUTER_JOIN

Deprecated

use JoinType#RIGHT_OUTER_JOIN instead.

Specifies a right join.

Annotations
@Deprecated
@SuppressWarnings:UnusedDeclaration

Constructor Detail

JoinFragmentback to summary
public JoinFragment()

Method Detail

addConditionback to summary
public abstract void addCondition(String alias, String[] fkColumns, String[] pkColumns)

Adds a condition to the join fragment.

Parameters
alias:String

The alias of the joined table

fkColumns:String[]

The names of the columns which reference the joined table

pkColumns:String[]

The columns in the joined table being referenced

addConditionback to summary
public abstract boolean addCondition(String condition)

Adds a free-form condition fragment

Parameters
condition:String

The fragment

Returns:boolean

true if the condition was added

addConditionback to summary
protected boolean addCondition(StringBuilder buffer, String on)

Appends the 'on' condition to the buffer, returning true if the condition was added. Returns false if the 'on' condition was empty.

Parameters
buffer:StringBuilder

The buffer to append the 'on' condition to.

on:String

The 'on' condition.

Returns:boolean

Returns true if the condition was added, false if the condition was already in 'on' string.

addCrossJoinback to summary
public abstract void addCrossJoin(String tableName, String alias)

Adds a cross join to the specified table.

Parameters
tableName:String

The name of the table to be joined

alias:String

The alias to apply to the joined table

addFragmentback to summary
public void addFragment(JoinFragment ojf)

Adds another join fragment to this one.

Parameters
ojf:JoinFragment

The other join fragment

addJoinback to summary
public abstract void addJoin(String tableName, String alias, String[] fkColumns, String[] pkColumns, JoinType joinType)

Adds a join.

Parameters
tableName:String

The name of the table to be joined

alias:String

The alias to apply to the joined table

fkColumns:String[]

The names of the columns which reference the joined table

pkColumns:String[]

The columns in the joined table being referenced

joinType:JoinType

The type of join

addJoinback to summary
public abstract void addJoin(String tableName, String alias, String[] fkColumns, String[] pkColumns, JoinType joinType, String on)

Adds a join, with an additional ON clause fragment

Parameters
tableName:String

The name of the table to be joined

alias:String

The alias to apply to the joined table

fkColumns:String[]

The names of the columns which reference the joined table

pkColumns:String[]

The columns in the joined table being referenced

joinType:JoinType

The type of join

on:String

The additional ON fragment

addJoinback to summary
public void addJoin(String tableName, String alias, String[][] fkColumns, String[] pkColumns, JoinType joinType, String on)

Adds a join, with an additional ON clause fragment

Parameters
tableName:String

The name of the table to be joined

alias:String

The alias to apply to the joined table

fkColumns:String[][]

The names of the columns which reference the joined table

pkColumns:String[]

The columns in the joined table being referenced

joinType:JoinType

The type of join

on:String

The additional ON fragment

addJoinsback to summary
public abstract void addJoins(String fromFragment, String whereFragment)

Free-form form of adding theta-style joins taking the necessary FROM and WHERE clause fragments

Parameters
fromFragment:String

The FROM clause fragment

whereFragment:String

The WHERE clause fragment

copyback to summary
public abstract JoinFragment copy()

Make a copy.

Returns:JoinFragment

The copy.

hasFilterConditionback to summary
public boolean hasFilterCondition()

True if the where fragment is from a filter condition.

Returns:boolean

True if the where fragment is from a filter condition.

hasThetaJoinsback to summary
public boolean hasThetaJoins()

Determine if the join fragment contained any theta-joins.

Returns:boolean

true if the fragment contained theta joins

setHasFilterConditionback to summary
public void setHasFilterCondition(boolean b)
setHasThetaJoinsback to summary
public void setHasThetaJoins(boolean hasThetaJoins)
toFromFragmentStringback to summary
public abstract String toFromFragmentString()

Render this fragment to its FROM clause portion

Returns:String

The FROM clause portion of this fragment

toWhereFragmentStringback to summary
public abstract String toWhereFragmentString()

Render this fragment to its WHERE clause portion

Returns:String

The WHERE clause portion of this fragment