FileDocCategorySizeDatePackage
AbstractEntityJoinWalker.javaAPI DocHibernate 3.2.54187Tue Jan 23 09:31:14 GMT 2007org.hibernate.loader

AbstractEntityJoinWalker

public abstract class AbstractEntityJoinWalker extends JoinWalker
Abstract walker for walkers which begin at an entity (criteria queries and entity loaders).
author
Gavin King

Fields Summary
private final org.hibernate.persister.entity.OuterJoinLoadable
persister
private String
alias
Constructors Summary
public AbstractEntityJoinWalker(org.hibernate.persister.entity.OuterJoinLoadable persister, org.hibernate.engine.SessionFactoryImplementor factory, Map enabledFilters)

		super( factory, enabledFilters );
		this.persister = persister;
		alias = generateRootAlias( persister.getEntityName() );
	
Methods Summary
protected final java.lang.StringgetAlias()

		return alias;
	
public abstract java.lang.StringgetComment()

protected final org.hibernate.persister.entity.LoadablegetPersister()

		return persister;
	
protected java.lang.StringgetWhereFragment()

		// here we do not bother with the discriminator.
		return persister.whereJoinFragment(alias, true, true);
	
protected final voidinitAll(java.lang.String whereString, java.lang.String orderByString, org.hibernate.LockMode lockMode)


		walkEntityTree( persister, getAlias() );

		List allAssociations = new ArrayList();
		allAssociations.addAll(associations);
		allAssociations.add( new OuterJoinableAssociation(
				persister.getEntityType(),
				null,
				null,
				alias,
				JoinFragment.LEFT_OUTER_JOIN,
				getFactory(),
				CollectionHelper.EMPTY_MAP
			) );

		initPersisters(allAssociations, lockMode);
		initStatementString( whereString, orderByString, lockMode);
	
protected final voidinitProjection(java.lang.String projectionString, java.lang.String whereString, java.lang.String orderByString, java.lang.String groupByString, org.hibernate.LockMode lockMode)

		walkEntityTree( persister, getAlias() );
		persisters = new Loadable[0];
		initStatementString(projectionString, whereString, orderByString, groupByString, lockMode);
	
private voidinitStatementString(java.lang.String condition, java.lang.String orderBy, org.hibernate.LockMode lockMode)

		initStatementString(null, condition, orderBy, "", lockMode);
	
private voidinitStatementString(java.lang.String projection, java.lang.String condition, java.lang.String orderBy, java.lang.String groupBy, org.hibernate.LockMode lockMode)


		final int joins = countEntityPersisters( associations );
		suffixes = BasicLoader.generateSuffixes( joins + 1 );

		JoinFragment ojf = mergeOuterJoins( associations );

		Select select = new Select( getDialect() )
				.setLockMode( lockMode )
				.setSelectClause(
						projection == null ?
								persister.selectFragment( alias, suffixes[joins] ) + selectString( associations ) :
								projection
				)
				.setFromClause(
						getDialect().appendLockHint( lockMode, persister.fromTableFragment( alias ) ) +
								persister.fromJoinFragment( alias, true, true )
				)
				.setWhereClause( condition )
				.setOuterJoins(
						ojf.toFromFragmentString(),
						ojf.toWhereFragmentString() + getWhereFragment()
				)
				.setOrderByClause( orderBy( associations, orderBy ) )
				.setGroupByClause( groupBy );

		if ( getFactory().getSettings().isCommentsEnabled() ) {
			select.setComment( getComment() );
		}
		sql = select.toStatementString();
	
protected booleanisJoinedFetchEnabled(org.hibernate.type.AssociationType type, org.hibernate.FetchMode config, org.hibernate.engine.CascadeStyle cascadeStyle)
The superclass deliberately excludes collections

		return isJoinedFetchEnabledInMapping(config, type);
	
public java.lang.StringtoString()

		return getClass().getName() + '(" + getPersister().getEntityName() + ')";