Package org.hibernate.sql
Class JoinFragment
- java.lang.Object
-
- org.hibernate.sql.JoinFragment
-
- Direct Known Subclasses:
ANSIJoinFragment
,OracleJoinFragment
,QueryJoinFragment
,Sybase11JoinFragment
public abstract class JoinFragment extends java.lang.Object
An abstract SQL join fragment renderer
-
-
Field Summary
Fields Modifier and Type Field Description static int
FULL_JOIN
Deprecated.useJoinType.FULL_JOIN
instead.static int
INNER_JOIN
Deprecated.useJoinType.INNER_JOIN
instead.static int
LEFT_OUTER_JOIN
Deprecated.useJoinType.LEFT_OUTER_JOIN
instead.static int
RIGHT_OUTER_JOIN
Deprecated.useJoinType.RIGHT_OUTER_JOIN
instead.
-
Constructor Summary
Constructors Constructor Description JoinFragment()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract boolean
addCondition(java.lang.String condition)
Adds a free-form condition fragmentprotected boolean
addCondition(java.lang.StringBuilder buffer, java.lang.String on)
Appends the 'on' condition to the buffer, returning true if the condition was added.abstract void
addCondition(java.lang.String alias, java.lang.String[] fkColumns, java.lang.String[] pkColumns)
Adds a condition to the join fragment.abstract void
addCrossJoin(java.lang.String tableName, java.lang.String alias)
Adds a cross join to the specified table.void
addFragment(JoinFragment ojf)
Adds another join fragment to this one.void
addJoin(java.lang.String tableName, java.lang.String alias, java.lang.String[][] fkColumns, java.lang.String[] pkColumns, JoinType joinType, java.lang.String on)
Adds a join, with an additional ON clause fragmentabstract void
addJoin(java.lang.String tableName, java.lang.String alias, java.lang.String[] fkColumns, java.lang.String[] pkColumns, JoinType joinType)
Adds a join.abstract void
addJoin(java.lang.String tableName, java.lang.String alias, java.lang.String[] fkColumns, java.lang.String[] pkColumns, JoinType joinType, java.lang.String on)
Adds a join, with an additional ON clause fragmentabstract void
addJoins(java.lang.String fromFragment, java.lang.String whereFragment)
Free-form form of adding theta-style joins taking the necessary FROM and WHERE clause fragmentsabstract JoinFragment
copy()
Make a copy.boolean
hasFilterCondition()
True if the where fragment is from a filter condition.boolean
hasThetaJoins()
Determine if the join fragment contained any theta-joins.void
setHasFilterCondition(boolean b)
void
setHasThetaJoins(boolean hasThetaJoins)
abstract java.lang.String
toFromFragmentString()
Render this fragment to its FROM clause portionabstract java.lang.String
toWhereFragmentString()
Render this fragment to its WHERE clause portion
-
-
-
Field Detail
-
INNER_JOIN
@Deprecated public static final int INNER_JOIN
Deprecated.useJoinType.INNER_JOIN
instead.Specifies an inner join.
-
FULL_JOIN
@Deprecated public static final int FULL_JOIN
Deprecated.useJoinType.FULL_JOIN
instead.Specifies a full join
-
LEFT_OUTER_JOIN
@Deprecated public static final int LEFT_OUTER_JOIN
Deprecated.useJoinType.LEFT_OUTER_JOIN
instead.Specifies a left join.
-
RIGHT_OUTER_JOIN
@Deprecated public static final int RIGHT_OUTER_JOIN
Deprecated.useJoinType.RIGHT_OUTER_JOIN
instead.Specifies a right join.
-
-
Method Detail
-
addJoin
public abstract void addJoin(java.lang.String tableName, java.lang.String alias, java.lang.String[] fkColumns, java.lang.String[] pkColumns, JoinType joinType)
Adds a join.- Parameters:
tableName
- The name of the table to be joinedalias
- The alias to apply to the joined tablefkColumns
- The names of the columns which reference the joined tablepkColumns
- The columns in the joined table being referencedjoinType
- The type of join
-
addJoin
public abstract void addJoin(java.lang.String tableName, java.lang.String alias, java.lang.String[] fkColumns, java.lang.String[] pkColumns, JoinType joinType, java.lang.String on)
Adds a join, with an additional ON clause fragment- Parameters:
tableName
- The name of the table to be joinedalias
- The alias to apply to the joined tablefkColumns
- The names of the columns which reference the joined tablepkColumns
- The columns in the joined table being referencedjoinType
- The type of joinon
- The additional ON fragment
-
addJoin
public void addJoin(java.lang.String tableName, java.lang.String alias, java.lang.String[][] fkColumns, java.lang.String[] pkColumns, JoinType joinType, java.lang.String on)
Adds a join, with an additional ON clause fragment- Parameters:
tableName
- The name of the table to be joinedalias
- The alias to apply to the joined tablefkColumns
- The names of the columns which reference the joined tablepkColumns
- The columns in the joined table being referencedjoinType
- The type of joinon
- The additional ON fragment
-
addCrossJoin
public abstract void addCrossJoin(java.lang.String tableName, java.lang.String alias)
Adds a cross join to the specified table.- Parameters:
tableName
- The name of the table to be joinedalias
- The alias to apply to the joined table
-
addJoins
public abstract void addJoins(java.lang.String fromFragment, java.lang.String whereFragment)
Free-form form of adding theta-style joins taking the necessary FROM and WHERE clause fragments- Parameters:
fromFragment
- The FROM clause fragmentwhereFragment
- The WHERE clause fragment
-
toFromFragmentString
public abstract java.lang.String toFromFragmentString()
Render this fragment to its FROM clause portion- Returns:
- The FROM clause portion of this fragment
-
toWhereFragmentString
public abstract java.lang.String toWhereFragmentString()
Render this fragment to its WHERE clause portion- Returns:
- The WHERE clause portion of this fragment
-
addCondition
public abstract void addCondition(java.lang.String alias, java.lang.String[] fkColumns, java.lang.String[] pkColumns)
Adds a condition to the join fragment.- Parameters:
alias
- The alias of the joined tablefkColumns
- The names of the columns which reference the joined tablepkColumns
- The columns in the joined table being referenced
-
addCondition
public abstract boolean addCondition(java.lang.String condition)
Adds a free-form condition fragment- Parameters:
condition
- The fragment- Returns:
true
if the condition was added
-
copy
public abstract JoinFragment copy()
Make a copy.- Returns:
- The copy.
-
addFragment
public void addFragment(JoinFragment ojf)
Adds another join fragment to this one.- Parameters:
ojf
- The other join fragment
-
addCondition
protected boolean addCondition(java.lang.StringBuilder buffer, java.lang.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
- The buffer to append the 'on' condition to.on
- The 'on' condition.- Returns:
- Returns true if the condition was added, false if the condition was already in 'on' string.
-
hasFilterCondition
public boolean hasFilterCondition()
True if the where fragment is from a filter condition.- Returns:
- True if the where fragment is from a filter condition.
-
setHasFilterCondition
public void setHasFilterCondition(boolean b)
-
hasThetaJoins
public boolean hasThetaJoins()
Determine if the join fragment contained any theta-joins.- Returns:
true
if the fragment contained theta joins
-
setHasThetaJoins
public void setHasThetaJoins(boolean hasThetaJoins)
-
-