Package org.hibernate.sql
Class ANSIJoinFragment
- java.lang.Object
-
- org.hibernate.sql.JoinFragment
-
- org.hibernate.sql.ANSIJoinFragment
-
- Direct Known Subclasses:
CacheJoinFragment
public class ANSIJoinFragment extends JoinFragment
An ANSI-style join.
-
-
Field Summary
-
Fields inherited from class org.hibernate.sql.JoinFragment
FULL_JOIN, INNER_JOIN, LEFT_OUTER_JOIN, RIGHT_OUTER_JOIN
-
-
Constructor Summary
Constructors Constructor Description ANSIJoinFragment()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addCondition(String condition)
Adds a free-form condition fragmentvoid
addCondition(String alias, String[] columns, String condition)
Adds a condition to the join fragment.void
addCondition(String alias, String[] fkColumns, String[] pkColumns)
Adds a condition to the join fragment.void
addCrossJoin(String tableName, String alias)
Adds a cross join to the specified table.void
addFromFragmentString(String fromFragmentString)
Adds an externally built join fragment.void
addJoin(String rhsTableName, String rhsAlias, String[][] lhsColumns, String[] rhsColumns, JoinType joinType, String on)
Adds a join, with an additional ON clause fragmentvoid
addJoin(String tableName, String alias, String[] fkColumns, String[] pkColumns, JoinType joinType)
Adds a join, represented by the given information, to the fragment.void
addJoin(String rhsTableName, String rhsAlias, String[] lhsColumns, String[] rhsColumns, JoinType joinType, String on)
Adds a join, represented by the given information, to the fragment.void
addJoins(String fromFragment, String whereFragment)
Free-form form of adding theta-style joins taking the necessary FROM and WHERE clause fragmentsJoinFragment
copy()
Make a copy.String
toFromFragmentString()
Render this fragment to its FROM clause portionString
toWhereFragmentString()
Render this fragment to its WHERE clause portion-
Methods inherited from class org.hibernate.sql.JoinFragment
addCondition, addFragment, hasFilterCondition, hasThetaJoins, setHasFilterCondition, setHasThetaJoins
-
-
-
-
Method Detail
-
addJoin
public void addJoin(String tableName, String alias, String[] fkColumns, String[] pkColumns, JoinType joinType)
Adds a join, represented by the given information, to the fragment.- Specified by:
addJoin
in classJoinFragment
- Parameters:
tableName
- The name of the table being joined.alias
- The alias applied to the table being joined.fkColumns
- The columns (from the table being joined) used to define the join-restriction (the ON)pkColumns
- The columns (from the table being joined to) used to define the join-restriction (the ON)joinType
- The type of join to produce (INNER, etc).
-
addJoin
public void addJoin(String rhsTableName, String rhsAlias, String[] lhsColumns, String[] rhsColumns, JoinType joinType, String on)
Adds a join, represented by the given information, to the fragment.- Specified by:
addJoin
in classJoinFragment
- Parameters:
rhsTableName
- The name of the table being joined (the RHS table).rhsAlias
- The alias applied to the table being joined (the alias for the RHS table).lhsColumns
- The columns (from the table being joined) used to define the join-restriction (the ON). These are the LHS columns, and are expected to be qualified.rhsColumns
- The columns (from the table being joined to) used to define the join-restriction (the ON). These are the RHS columns and are expected to *not* be qualified.joinType
- The type of join to produce (INNER, etc).on
- Any extra join restrictions
-
addJoin
public void addJoin(String rhsTableName, String rhsAlias, String[][] lhsColumns, String[] rhsColumns, JoinType joinType, String on)
Description copied from class:JoinFragment
Adds a join, with an additional ON clause fragment- Overrides:
addJoin
in classJoinFragment
- Parameters:
rhsTableName
- The name of the table to be joinedrhsAlias
- The alias to apply to the joined tablelhsColumns
- The names of the columns which reference the joined tablerhsColumns
- The columns in the joined table being referencedjoinType
- The type of joinon
- The additional ON fragment
-
toFromFragmentString
public String toFromFragmentString()
Description copied from class:JoinFragment
Render this fragment to its FROM clause portion- Specified by:
toFromFragmentString
in classJoinFragment
- Returns:
- The FROM clause portion of this fragment
-
toWhereFragmentString
public String toWhereFragmentString()
Description copied from class:JoinFragment
Render this fragment to its WHERE clause portion- Specified by:
toWhereFragmentString
in classJoinFragment
- Returns:
- The WHERE clause portion of this fragment
-
addJoins
public void addJoins(String fromFragment, String whereFragment)
Description copied from class:JoinFragment
Free-form form of adding theta-style joins taking the necessary FROM and WHERE clause fragments- Specified by:
addJoins
in classJoinFragment
- Parameters:
fromFragment
- The FROM clause fragmentwhereFragment
- The WHERE clause fragment
-
copy
public JoinFragment copy()
Description copied from class:JoinFragment
Make a copy.- Specified by:
copy
in classJoinFragment
- Returns:
- The copy.
-
addCondition
public void addCondition(String alias, String[] columns, String condition)
Adds a condition to the join fragment. For each given column a predicate is built in the form:[alias.[column] = [condition]
- Parameters:
alias
- The alias to apply to column(s)columns
- The columns to apply restrictioncondition
- The restriction condition
-
addCrossJoin
public void addCrossJoin(String tableName, String alias)
Description copied from class:JoinFragment
Adds a cross join to the specified table.- Specified by:
addCrossJoin
in classJoinFragment
- Parameters:
tableName
- The name of the table to be joinedalias
- The alias to apply to the joined table
-
addCondition
public void addCondition(String alias, String[] fkColumns, String[] pkColumns)
Description copied from class:JoinFragment
Adds a condition to the join fragment.- Specified by:
addCondition
in classJoinFragment
- 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 boolean addCondition(String condition)
Description copied from class:JoinFragment
Adds a free-form condition fragment- Specified by:
addCondition
in classJoinFragment
- Parameters:
condition
- The fragment- Returns:
true
if the condition was added
-
addFromFragmentString
public void addFromFragmentString(String fromFragmentString)
Adds an externally built join fragment.- Parameters:
fromFragmentString
- The join fragment string
-
-