protected void initFromWalker(JoinWalker walker) { persisters = walker.getPersisters(); collectionPersisters = walker.getCollectionPersisters(); ownerAssociationTypes = walker.getOwnerAssociationTypes(); lockOptions = walker.getLockModeOptions(); lockModeArray = walker.getLockModeArray(); suffixes = walker.getSuffixes(); collectionSuffixes = walker.getCollectionSuffixes(); owners = walker.getOwners(); collectionOwners = walker.getCollectionOwners(); sql = walker.getSQLString(); aliases = walker.getAliases(); }
/** * Add on association (one-to-one, many-to-one, or a collection) to a list * of associations to be fetched by outerjoin (if necessary) */ private void addAssociationToJoinTreeIfNecessary( final AssociationType type, final String[] aliasedLhsColumns, final String alias, final PropertyPath path, int currentDepth, final JoinType joinType) throws MappingException { if ( joinType != JoinType.NONE ) { addAssociationToJoinTree( type, aliasedLhsColumns, alias, path, currentDepth, joinType ); } }
AssociationType associationType = (AssociationType) types[i]; String[] aliasedLhsColumns = JoinHelper.getAliasedLHSColumnNames( associationType, alias, propertyNumber, begin, persister, getFactory() ); String[] lhsColumns = JoinHelper.getLHSColumnNames( associationType, propertyNumber, begin, persister, getFactory() ); String lhsTable = JoinHelper.getLHSTableName( associationType, propertyNumber, persister ); final JoinType joinType = getJoinType( persister, subPath, currentDepth ); addAssociationToJoinTreeIfNecessary( associationType, aliasedLhsColumns, walkComponentTree( (CompositeType) types[i], propertyNumber, ); begin += types[i].getColumnSpan( getFactory() );
final JoinType joinType) throws MappingException { Joinable joinable = type.getAssociatedJoinable( getFactory() ); String subalias = generateTableAlias( associations.size() + 1, path, joinable ); subalias, joinType, joinable.consumesEntityAlias() ? getWithClause( path ) : "", hasRestriction( path ), getFactory(), loadQueryInfluencers.getEnabledFilters() ); walkEntityTree( (OuterJoinLoadable) joinable, subalias, walkCollectionTree( (QueryableCollection) joinable, subalias,
private void compare(JoinWalker walker, LoadQueryDetails details) { System.out.println( "------ SQL -----------------------------------------------------------------" ); System.out.println( "WALKER : " + walker.getSQLString() ); System.out.println( "LOAD-PLAN : " + details.getSqlStatement() ); System.out.println( "----------------------------------------------------------------------------" ); System.out.println( ); System.out.println( "------ SUFFIXES ------------------------------------------------------------" ); System.out.println( "WALKER : " + String.join( ", ", walker.getSuffixes() ) + " : " + String.join( ", ", walker.getCollectionSuffixes() ) ); System.out.println( "----------------------------------------------------------------------------" ); System.out.println( ); } }
walkEntityTree( (OuterJoinLoadable) persister.getElementPersister(), alias, final JoinType joinType = getJoinType( associationType, persister.getFetchMode(), addAssociationToJoinTreeIfNecessary( associationType, aliasedLhsColumns, walkCompositeElementTree( (CompositeType) type, persister.getElementColumnNames(),
final int currentDepth) throws MappingException { String[] aliasedLhsColumns = JoinHelper.getAliasedLHSColumnNames( associationType, alias, propertyNumber, persister, getFactory() ); String[] lhsColumns = JoinHelper.getLHSColumnNames( associationType, propertyNumber, persister, getFactory() ); String lhsTable = JoinHelper.getLHSTableName( associationType, propertyNumber, persister ); JoinType joinType = getJoinType( persister, subPath, currentDepth ); addAssociationToJoinTreeIfNecessary( associationType, aliasedLhsColumns,
final LockOptions lockOptions, final AssociationInitCallback callback) throws MappingException { final int joins = countEntityPersisters( associations ); final int collections = countCollectionPersisters( associations );
throws MappingException { Joinable joinable = type.getAssociatedJoinable( getFactory() ); String subalias = generateTableAlias( associations.size()+1, //before adding to collection! path, subalias, joinType, getFactory(), enabledFilters ); if ( !joinable.isCollection() ) { if (joinable instanceof OuterJoinLoadable) { walkEntityTree( (OuterJoinLoadable) joinable, subalias, walkCollectionTree( (QueryableCollection) joinable, subalias,
protected void initPersisters(final List associations, final LockMode lockMode) throws MappingException { final int joins = countEntityPersisters(associations); final int collections = countCollectionPersisters(associations);
private void compare(JoinWalker walker, LoadQueryDetails details) { System.out.println( "WALKER : " + walker.getSQLString() ); System.out.println( "LOAD-PLAN : " + details.getSqlStatement() ); System.out.println(); }
final JoinType joinType) throws MappingException { Joinable joinable = type.getAssociatedJoinable( getFactory() ); String subalias = generateTableAlias( associations.size() + 1, path, joinable ); subalias, joinType, getWithClause(path), hasRestriction( path ), getFactory(), loadQueryInfluencers.getEnabledFilters() walkEntityTree( (OuterJoinLoadable) joinable, subalias, walkCollectionTree( (QueryableCollection) joinable, subalias,
walkEntityTree( (OuterJoinLoadable) persister.getElementPersister(), alias, final int joinType = getJoinType( associationType, persister.getFetchMode(), addAssociationToJoinTreeIfNecessary( associationType, aliasedLhsColumns, walkCompositeElementTree( (AbstractComponentType) type, persister.getElementColumnNames(),
final int currentDepth) throws MappingException { String[] aliasedLhsColumns = JoinHelper.getAliasedLHSColumnNames( associationType, alias, propertyNumber, persister, getFactory() ); String[] lhsColumns = JoinHelper.getLHSColumnNames( associationType, propertyNumber, persister, getFactory() ); String lhsTable = JoinHelper.getLHSTableName(associationType, propertyNumber, persister); JoinType joinType = getJoinType( persister, subPath, currentDepth ); addAssociationToJoinTreeIfNecessary( associationType, aliasedLhsColumns,
final LockOptions lockOptions, final AssociationInitCallback callback) throws MappingException { final int joins = countEntityPersisters(associations); final int collections = countCollectionPersisters(associations);
public DynamicBatchingCollectionLoader( QueryableCollection collectionPersister, SessionFactoryImplementor factory, LoadQueryInfluencers influencers) { super( collectionPersister, factory, influencers ); JoinWalker walker = buildJoinWalker( collectionPersister, factory, influencers ); initFromWalker( walker ); this.sqlTemplate = walker.getSQLString(); this.alias = StringHelper.generateAlias( collectionPersister.getRole(), 0 ); postInstantiate(); if ( LOG.isDebugEnabled() ) { LOG.debugf( "SQL-template for dynamic collection [%s] batch-fetching : %s", collectionPersister.getRole(), sqlTemplate ); } }
protected void initFromWalker(JoinWalker walker) { persisters = walker.getPersisters(); collectionPersisters = walker.getCollectionPersisters(); ownerAssociationTypes = walker.getOwnerAssociationTypes(); lockModeArray = walker.getLockModeArray(); suffixes = walker.getSuffixes(); collectionSuffixes = walker.getCollectionSuffixes(); owners = walker.getOwners(); collectionOwners = walker.getCollectionOwners(); sql = walker.getSQLString(); aliases = walker.getAliases(); }
int begin = 0; for ( int i = 0; i < types.length; i++ ) { int length = types[i].getColumnSpan( getFactory() ); String[] lhsColumns = ArrayHelper.slice( cols, begin, length ); final JoinType joinType = getJoinType( associationType, compositeType.getFetchMode( i ), compositeType.getCascadeStyle( i ) ); addAssociationToJoinTreeIfNecessary( associationType, aliasedLhsColumns, walkCompositeElementTree( (CompositeType) types[i], lhsColumns,
final JoinType joinType) throws MappingException { Joinable joinable = type.getAssociatedJoinable( getFactory() ); String subalias = generateTableAlias( associations.size() + 1, path, joinable ); subalias, joinType, getWithClause(path), hasRestriction( path ), getFactory(), loadQueryInfluencers.getEnabledFilters() walkEntityTree( (OuterJoinLoadable) joinable, subalias, walkCollectionTree( (QueryableCollection) joinable, subalias,
walkEntityTree( (OuterJoinLoadable) persister.getElementPersister(), alias, final JoinType joinType = getJoinType( associationType, persister.getFetchMode(), addAssociationToJoinTreeIfNecessary( associationType, aliasedLhsColumns, walkCompositeElementTree( (CompositeType) type, persister.getElementColumnNames(),