QueryJoinFragmentpublic class QueryJoinFragment extends JoinFragment A join that appears in a translated HQL query |
Fields Summary |
---|
private StringBuffer | afterFrom | private StringBuffer | afterWhere | private org.hibernate.dialect.Dialect | dialect | private boolean | useThetaStyleInnerJoins |
Constructors Summary |
---|
public QueryJoinFragment(org.hibernate.dialect.Dialect dialect, boolean useThetaStyleInnerJoins)
this.dialect = dialect;
this.useThetaStyleInnerJoins = useThetaStyleInnerJoins;
|
Methods Summary |
---|
public void | addCondition(java.lang.String alias, java.lang.String[] fkColumns, java.lang.String[] pkColumns)
for ( int j = 0; j < fkColumns.length; j++ ) {
afterWhere.append( " and " )
.append( fkColumns[j] )
.append( '=" )
.append( alias )
.append( '." )
.append( pkColumns[j] );
}
| public boolean | addCondition(java.lang.String condition)Add the condition string to the join fragment.
// if the condition is not already there...
if (
afterFrom.toString().indexOf( condition.trim() ) < 0 &&
afterWhere.toString().indexOf( condition.trim() ) < 0
) {
if ( !condition.startsWith( " and " ) ) {
afterWhere.append( " and " );
}
afterWhere.append( condition );
return true;
}
else {
return false;
}
| public void | addCondition(java.lang.String alias, java.lang.String[] columns, java.lang.String condition)
for ( int i = 0; i < columns.length; i++ ) {
afterWhere.append( " and " )
.append( alias )
.append( '." )
.append( columns[i] )
.append( condition );
}
| public void | addCrossJoin(java.lang.String tableName, java.lang.String alias)
afterFrom.append( ", " )
.append( tableName )
.append( ' " )
.append( alias );
| public void | addFromFragmentString(java.lang.String fromFragmentString)
afterFrom.append( fromFragmentString );
| public void | addJoin(java.lang.String tableName, java.lang.String alias, java.lang.String[] fkColumns, java.lang.String[] pkColumns, int joinType)
addJoin( tableName, alias, alias, fkColumns, pkColumns, joinType, null );
| public void | addJoin(java.lang.String tableName, java.lang.String alias, java.lang.String[] fkColumns, java.lang.String[] pkColumns, int joinType, java.lang.String on)
addJoin( tableName, alias, alias, fkColumns, pkColumns, joinType, on );
| private void | addJoin(java.lang.String tableName, java.lang.String alias, java.lang.String concreteAlias, java.lang.String[] fkColumns, java.lang.String[] pkColumns, int joinType, java.lang.String on)
if ( !useThetaStyleInnerJoins || joinType != INNER_JOIN ) {
JoinFragment jf = dialect.createOuterJoinFragment();
jf.addJoin( tableName, alias, fkColumns, pkColumns, joinType, on );
addFragment( jf );
}
else {
addCrossJoin( tableName, alias );
addCondition( concreteAlias, fkColumns, pkColumns );
addCondition( on );
}
| public void | addJoins(java.lang.String fromFragment, java.lang.String whereFragment)
afterFrom.append( fromFragment );
afterWhere.append( whereFragment );
| public void | clearWherePart()
afterWhere.setLength( 0 );
| public JoinFragment | copy()
QueryJoinFragment copy = new QueryJoinFragment( dialect, useThetaStyleInnerJoins );
copy.afterFrom = new StringBuffer( afterFrom.toString() );
copy.afterWhere = new StringBuffer( afterWhere.toString() );
return copy;
| public java.lang.String | toFromFragmentString()
return afterFrom.toString();
| public java.lang.String | toWhereFragmentString()
return afterWhere.toString();
|
|