public EntityJoinWalker( OuterJoinLoadable persister, String[] uniqueKey, int batchSize, LockMode lockMode, final SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers) throws MappingException { super( persister, factory, loadQueryInfluencers ); this.lockOptions.setLockMode(lockMode); StringBuilder whereCondition = whereString( getAlias(), uniqueKey, batchSize ) //include the discriminator and class-level where, but not filters .append( persister.filterFragment( getAlias(), Collections.EMPTY_MAP ) ); AssociationInitCallbackImpl callback = new AssociationInitCallbackImpl( factory ); initAll( whereCondition.toString(), "", lockOptions, callback ); this.compositeKeyManyToOneTargetIndices = callback.resolve(); }
public EntityJoinWalker( OuterJoinLoadable persister, String[] uniqueKey, int batchSize, LockOptions lockOptions, SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers) throws MappingException { super( persister, factory, loadQueryInfluencers ); LockOptions.copy(lockOptions, this.lockOptions); StringBuilder whereCondition = whereString( getAlias(), uniqueKey, batchSize ) //include the discriminator and class-level where, but not filters .append( persister.filterFragment( getAlias(), Collections.EMPTY_MAP ) ); AssociationInitCallbackImpl callback = new AssociationInitCallbackImpl( factory ); initAll( whereCondition.toString(), "", lockOptions, callback ); this.compositeKeyManyToOneTargetIndices = callback.resolve(); }
public CascadeEntityLoader( OuterJoinLoadable persister, CascadingAction action, SessionFactoryImplementor factory) throws MappingException { super( persister, persister.getIdentifierType(), factory, LoadQueryInfluencers.NONE ); JoinWalker walker = new CascadeEntityJoinWalker( persister, action, factory ); initFromWalker( walker ); postInstantiate(); if ( LOG.isDebugEnabled() ) { LOG.debugf( "Static select for action %s on entity %s: %s", action, entityName, getSQLString() ); } }
public EntityLoader( OuterJoinLoadable persister, int batchSize, LockMode lockMode, SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers) throws MappingException { this( persister, persister.getIdentifierColumnNames(), persister.getIdentifierType(), batchSize, lockMode, factory, loadQueryInfluencers ); }
public EntityLoader( OuterJoinLoadable persister, int batchSize, LockOptions lockOptions, SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers) throws MappingException { this( persister, persister.getIdentifierColumnNames(), persister.getIdentifierType(), batchSize, lockOptions, factory, loadQueryInfluencers ); }
public LegacyBatchingEntityLoader( OuterJoinLoadable persister, int maxBatchSize, LockMode lockMode, SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers) { super( persister ); this.batchSizes = ArrayHelper.getBatchSizes( maxBatchSize ); this.loaders = new EntityLoader[ batchSizes.length ]; final EntityLoader.Builder entityLoaderBuilder = EntityLoader.forEntity( persister ) .withInfluencers( loadQueryInfluencers ) .withLockMode( lockMode ); for ( int i = 0; i < batchSizes.length; i++ ) { this.loaders[i] = entityLoaderBuilder.withBatchSize( batchSizes[i] ).byPrimaryKey(); } }
public LegacyBatchingEntityLoader( OuterJoinLoadable persister, int maxBatchSize, LockOptions lockOptions, SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers) { super( persister ); this.batchSizes = ArrayHelper.getBatchSizes( maxBatchSize ); this.loaders = new EntityLoader[ batchSizes.length ]; final EntityLoader.Builder entityLoaderBuilder = EntityLoader.forEntity( persister ) .withInfluencers( loadQueryInfluencers ) .withLockOptions( lockOptions ); for ( int i = 0; i < batchSizes.length; i++ ) { this.loaders[i] = entityLoaderBuilder.withBatchSize( batchSizes[i] ).byPrimaryKey(); } }
protected final boolean isJoinFetchEnabledByProfile(OuterJoinLoadable persister, PropertyPath path, int propertyNumber) { if ( !getLoadQueryInfluencers().hasEnabledFetchProfiles() ) { // perf optimization return false; } // ugh, this stuff has to be made easier... final String fullPath = path.getFullPath(); String rootPropertyName = persister.getSubclassPropertyName( propertyNumber ); int pos = fullPath.lastIndexOf( rootPropertyName ); String relativePropertyPath = pos >= 0 ? fullPath.substring( pos ) : rootPropertyName; String fetchRole = persister.getEntityName() + "." + relativePropertyPath; for ( String profileName : getLoadQueryInfluencers().getEnabledFetchProfileNames() ) { final FetchProfile profile = getFactory().getFetchProfile( profileName ); final Fetch fetch = profile.getFetchByRole( fetchRole ); if ( fetch != null && Fetch.Style.JOIN == fetch.getStyle() ) { return true; } } return false; }
/** * Determine the appropriate type of join (if any) to use to fetch the * given association. * * @param persister The owner of the association. * @param path The path to the association * @param propertyNumber The property number representing the association. * @param associationType The association type. * @param metadataFetchMode The metadata-defined fetch mode. * @param metadataCascadeStyle The metadata-defined cascade style. * @param lhsTable The owner table * @param lhsColumns The owner join columns * @param nullable Is the association nullable. * @param currentDepth Current join depth * @return type of join to use ({@link org.hibernate.sql.JoinType#INNER_JOIN}, * {@link org.hibernate.sql.JoinType#LEFT_OUTER_JOIN}, or -1 to indicate no joining. * @throws MappingException ?? */ protected JoinType getJoinType( OuterJoinLoadable persister, final PropertyPath path, int propertyNumber, AssociationType associationType, FetchMode metadataFetchMode, CascadeStyle metadataCascadeStyle, String lhsTable, String[] lhsColumns, final boolean nullable, final int currentDepth) throws MappingException { return getJoinType( associationType, metadataFetchMode, path, lhsTable, lhsColumns, nullable, currentDepth, metadataCascadeStyle ); }
public OneToManyJoinWalker( QueryableCollection oneToManyPersister, int batchSize, String subquery, SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers) throws MappingException { super( factory, loadQueryInfluencers ); this.oneToManyPersister = oneToManyPersister; final OuterJoinLoadable elementPersister = (OuterJoinLoadable) oneToManyPersister.getElementPersister(); final String alias = generateRootAlias( oneToManyPersister.getRole() ); walkEntityTree(elementPersister, alias); List allAssociations = new ArrayList(); allAssociations.addAll(associations); allAssociations.add( OuterJoinableAssociation.createRoot( oneToManyPersister.getCollectionType(), alias, getFactory() ) ); initPersisters(allAssociations, LockMode.NONE); initStatementString(elementPersister, alias, batchSize, subquery); }
/** * Applies "table fragments" to the FROM-CLAUSE of the given SelectStatementBuilder for the given Loadable * * @param select The SELECT statement builder * * @see org.hibernate.persister.entity.OuterJoinLoadable#fromTableFragment(java.lang.String) * @see org.hibernate.persister.entity.Joinable#fromJoinFragment(java.lang.String, boolean, boolean) */ protected void applyRootReturnTableFragments(SelectStatementBuilder select) { final String fromTableFragment; final String rootAlias = entityReferenceAliases.getTableAlias(); final OuterJoinLoadable outerJoinLoadable = (OuterJoinLoadable) getRootEntityReturn().getEntityPersister(); if ( getQueryBuildingParameters().getLockOptions() != null ) { fromTableFragment = getSessionFactory().getDialect().appendLockHint( getQueryBuildingParameters().getLockOptions(), outerJoinLoadable.fromTableFragment( rootAlias ) ); select.setLockOptions( getQueryBuildingParameters().getLockOptions() ); } else if ( getQueryBuildingParameters().getLockMode() != null ) { fromTableFragment = getSessionFactory().getDialect().appendLockHint( getQueryBuildingParameters().getLockMode(), outerJoinLoadable.fromTableFragment( rootAlias ) ); select.setLockMode( getQueryBuildingParameters().getLockMode() ); } else { fromTableFragment = outerJoinLoadable.fromTableFragment( rootAlias ); } select.appendFromClauseFragment( fromTableFragment + outerJoinLoadable.fromJoinFragment( rootAlias, true, true ) ); }
@Override protected void applyRootReturnSelectFragments(SelectStatementBuilder selectStatementBuilder) { if ( getQueryableCollection().hasIndex() && getQueryableCollection().getIndexType().isEntityType() ) { final EntityReference indexEntityReference = getRootCollectionReturn().getIndexGraph().resolveEntityReference(); final EntityReferenceAliases indexEntityReferenceAliases = getAliasResolutionContext().resolveEntityReferenceAliases( indexEntityReference.getQuerySpaceUid() ); selectStatementBuilder.appendSelectClauseFragment( ( (OuterJoinLoadable) indexEntityReference.getEntityPersister() ).selectFragment( indexEntityReferenceAliases.getTableAlias(), indexEntityReferenceAliases.getColumnAliases().getSuffix() ) ); } }
@Override protected void applyRootReturnSelectFragments(SelectStatementBuilder selectStatementBuilder) { selectStatementBuilder.appendSelectClauseFragment( getQueryableCollection().selectFragment( getCollectionReferenceAliases().getCollectionTableAlias(), getCollectionReferenceAliases().getCollectionColumnAliases().getSuffix() ) ); if ( getQueryableCollection().isManyToMany() ) { final OuterJoinLoadable elementPersister = (OuterJoinLoadable) getQueryableCollection().getElementPersister(); selectStatementBuilder.appendSelectClauseFragment( elementPersister.selectFragment( getCollectionReferenceAliases().getElementTableAlias(), getCollectionReferenceAliases().getEntityElementAliases().getColumnAliases().getSuffix() ) ); } super.applyRootReturnSelectFragments( selectStatementBuilder ); }
public String selectFragment( Joinable rhs, String rhsAlias, String lhsAlias, String entitySuffix, String collectionSuffix, boolean includeCollectionColumns) { StringBuilder buf = new StringBuilder(); if ( includeCollectionColumns ) { // buf.append( selectFragment( lhsAlias, "" ) )//ignore suffix for collection columns! buf.append( selectFragment( lhsAlias, collectionSuffix ) ) .append( ", " ); } OuterJoinLoadable ojl = ( OuterJoinLoadable ) getElementPersister(); return buf.append( ojl.selectFragment( lhsAlias, entitySuffix ) )//use suffix for the entity columns .toString(); }
@Override public FetchStrategy determineFetchPlan(LoadQueryInfluencers loadQueryInfluencers, PropertyPath propertyPath) { final EntityPersister owningPersister = getSource().getEntityPersister(); FetchStyle style = FetchStrategyHelper.determineFetchStyleByProfile( loadQueryInfluencers, owningPersister, propertyPath, attributeNumber() ); if ( style == null ) { style = FetchStrategyHelper.determineFetchStyleByMetadata( ( (OuterJoinLoadable) getSource().getEntityPersister() ).getFetchMode( attributeNumber() ), getType(), sessionFactory() ); } return new FetchStrategy( FetchStrategyHelper.determineFetchTiming( style, getType(), sessionFactory() ), style ); }
/** * Get the qualified (prefixed by alias) names of the columns of the owning entity which are to be used in the join * * @param associationType The association type for the association that represents the join * @param columnQualifier The left-hand side table alias * @param propertyIndex The index of the property that represents the association/join * @param begin The index for any nested (composites) attributes * @param lhsPersister The persister for the left-hand side of the association/join * @param mapping The mapping (typically the SessionFactory). * * @return The qualified column names. */ public static String[] getAliasedLHSColumnNames( AssociationType associationType, String columnQualifier, int propertyIndex, int begin, OuterJoinLoadable lhsPersister, Mapping mapping) { if ( associationType.useLHSPrimaryKey() ) { return StringHelper.qualify( columnQualifier, lhsPersister.getIdentifierColumnNames() ); } else { final String propertyName = associationType.getLHSPropertyName(); if ( propertyName == null ) { return ArrayHelper.slice( toColumns( lhsPersister, columnQualifier, propertyIndex ), begin, associationType.getColumnSpan( mapping ) ); } else { //bad cast return ( (PropertyMapping) lhsPersister ).toColumns( columnQualifier, propertyName ); } } }
public static String showSql(Criteria criteria){ try { CriteriaImpl c = (CriteriaImpl) criteria; SessionImpl s = (SessionImpl) c.getSession(); SessionFactoryImplementor factory = (SessionFactoryImplementor) s.getSessionFactory(); String[] implementors = factory.getImplementors(c.getEntityOrClassName()); LoadQueryInfluencers lqis = new LoadQueryInfluencers(); CriteriaLoader loader = new CriteriaLoader((OuterJoinLoadable) factory.getEntityPersister(implementors[0]), factory, c, implementors[0], lqis); Field f = OuterJoinLoader.class.getDeclaredField("sql"); f.setAccessible(true); return (String) f.get(loader); }catch (Exception e){ e.printStackTrace(); return ""; } }
public EntityJoinWalker( OuterJoinLoadable persister, String[] uniqueKey, int batchSize, LockMode lockMode, SessionFactoryImplementor factory, Map enabledFilters) throws MappingException { super(persister, factory, enabledFilters); this.lockMode = lockMode; StringBuffer whereCondition = whereString( getAlias(), uniqueKey, batchSize ) //include the discriminator and class-level where, but not filters .append( persister.filterFragment( getAlias(), Collections.EMPTY_MAP ) ); initAll( whereCondition.toString(), "", lockMode ); }
public CascadeEntityLoader( OuterJoinLoadable persister, CascadingAction action, SessionFactoryImplementor factory) throws MappingException { super( persister, persister.getIdentifierType(), factory, CollectionHelper.EMPTY_MAP ); JoinWalker walker = new CascadeEntityJoinWalker( persister, action, factory ); initFromWalker( walker ); postInstantiate(); log.debug( "Static select for action " + action + " on entity " + entityName + ": " + getSQLString() ); }
public static UniqueEntityLoader createBatchingEntityLoader( final OuterJoinLoadable persister, final int maxBatchSize, final LockMode lockMode, final SessionFactoryImplementor factory, final Map enabledFilters) throws MappingException { if ( maxBatchSize>1 ) { int[] batchSizesToCreate = ArrayHelper.getBatchSizes(maxBatchSize); Loader[] loadersToCreate = new Loader[ batchSizesToCreate.length ]; for ( int i=0; i<batchSizesToCreate.length; i++ ) { loadersToCreate[i] = new EntityLoader(persister, batchSizesToCreate[i], lockMode, factory, enabledFilters); } return new BatchingEntityLoader(persister, batchSizesToCreate, loadersToCreate); } else { return new EntityLoader(persister, lockMode, factory, enabledFilters); } }
public EntityLoader( OuterJoinLoadable persister, int batchSize, LockMode lockMode, SessionFactoryImplementor factory, Map enabledFilters) throws MappingException { this( persister, persister.getIdentifierColumnNames(), persister.getIdentifierType(), batchSize, lockMode, factory, enabledFilters ); }
public String selectFragment( Joinable rhs, String rhsAlias, String lhsAlias, String entitySuffix, String collectionSuffix, boolean includeCollectionColumns) { StringBuffer buf = new StringBuffer(); if ( includeCollectionColumns ) { // buf.append( selectFragment( lhsAlias, "" ) )//ignore suffix for collection columns! buf.append( selectFragment( lhsAlias, collectionSuffix ) ) .append( ", " ); } OuterJoinLoadable ojl = ( OuterJoinLoadable ) getElementPersister(); return buf.append( ojl.selectFragment( lhsAlias, entitySuffix ) )//use suffix for the entity columns .toString(); }
/** * Get the aliased columns of the owning entity which are to * be used in the join */ public static String[] getAliasedLHSColumnNames( AssociationType type, String alias, int property, int begin, OuterJoinLoadable lhsPersister, Mapping mapping ) { if ( type.useLHSPrimaryKey() ) { return StringHelper.qualify( alias, lhsPersister.getIdentifierColumnNames() ); } else { String propertyName = type.getLHSPropertyName(); if (propertyName==null) { return ArrayHelper.slice( lhsPersister.toColumns(alias, property), begin, type.getColumnSpan(mapping) ); } else { return ( (PropertyMapping) lhsPersister ).toColumns(alias, propertyName); //bad cast } } }
@Override public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException { final StringBuilder buf = new StringBuilder( toLeftSqlString( criteria, criteriaQuery ) ); if ( op != null ) { buf.append( ' ' ).append( op ).append( ' ' ); } if ( quantifier != null ) { buf.append( quantifier ).append( ' ' ); } final SessionFactoryImplementor factory = criteriaQuery.getFactory(); final OuterJoinLoadable persister = (OuterJoinLoadable) factory.getEntityPersister( criteriaImpl.getEntityOrClassName() ); createAndSetInnerQuery( criteriaQuery, factory ); criteriaImpl.setSession( deriveRootSession( criteria ) ); final CriteriaJoinWalker walker = new CriteriaJoinWalker( persister, innerQuery, factory, criteriaImpl, criteriaImpl.getEntityOrClassName(), criteriaImpl.getSession().getLoadQueryInfluencers(), innerQuery.getRootSQLALias() ); return buf.append( '(' ).append( walker.getSQLString() ).append( ')' ).toString(); }
public AbstractEntityLoader( OuterJoinLoadable persister, Type uniqueKeyType, SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers) { super( factory, loadQueryInfluencers ); this.uniqueKeyType = uniqueKeyType; this.entityName = persister.getEntityName(); this.persister = persister; }
/** * Builds a batch-fetch capable loader based on the given persister, lock-mode, etc. * * @param persister The entity persister * @param batchSize The maximum number of ids to batch-fetch at once * @param lockMode The lock mode * @param factory The SessionFactory * @param influencers Any influencers that should affect the built query * * @return The loader. */ public UniqueEntityLoader buildLoader( OuterJoinLoadable persister, int batchSize, LockMode lockMode, SessionFactoryImplementor factory, LoadQueryInfluencers influencers) { if ( batchSize <= 1 ) { // no batching return buildNonBatchingLoader( persister, lockMode, factory, influencers ); } return buildBatchingLoader( persister, batchSize, lockMode, factory, influencers ); }
protected UniqueEntityLoader buildNonBatchingLoader( OuterJoinLoadable persister, LockMode lockMode, SessionFactoryImplementor factory, LoadQueryInfluencers influencers) { return new EntityLoader( persister, lockMode, factory, influencers ); }
/** * Builds a batch-fetch capable loader based on the given persister, lock-options, etc. * * @param persister The entity persister * @param batchSize The maximum number of ids to batch-fetch at once * @param lockOptions The lock options * @param factory The SessionFactory * @param influencers Any influencers that should affect the built query * * @return The loader. */ public UniqueEntityLoader buildLoader( OuterJoinLoadable persister, int batchSize, LockOptions lockOptions, SessionFactoryImplementor factory, LoadQueryInfluencers influencers) { if ( batchSize <= 1 ) { // no batching return buildNonBatchingLoader( persister, lockOptions, factory, influencers ); } return buildBatchingLoader( persister, batchSize, lockOptions, factory, influencers ); }
protected UniqueEntityLoader buildNonBatchingLoader( OuterJoinLoadable persister, LockOptions lockOptions, SessionFactoryImplementor factory, LoadQueryInfluencers influencers) { return new EntityLoader( persister, lockOptions, factory, influencers ); }
protected JoinType getJoinType( OuterJoinLoadable persister, PropertyPath path, int propertyNumber, AssociationType associationType, FetchMode metadataFetchMode, CascadeStyle metadataCascadeStyle, String lhsTable, String[] lhsColumns, boolean nullable, int currentDepth) throws MappingException { // NOTE : we override this form here specifically to account for // fetch profiles. // TODO : how to best handle criteria queries? if ( lockOptions.getLockMode().greaterThan( LockMode.READ ) ) { return JoinType.NONE; } if ( isTooDeep( currentDepth ) || ( associationType.isCollectionType() && isTooManyCollections() ) ) { return JoinType.NONE; } if ( !isJoinedFetchEnabledInMapping( metadataFetchMode, associationType ) && !isJoinFetchEnabledByProfile( persister, path, propertyNumber ) ) { return JoinType.NONE; } if ( isDuplicateAssociation( lhsTable, lhsColumns, associationType ) ) { return JoinType.NONE; } return getJoinType( nullable, currentDepth ); }
public EntityLoader( OuterJoinLoadable persister, LockMode lockMode, SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers) throws MappingException { this( persister, 1, lockMode, factory, loadQueryInfluencers ); }
public EntityLoader( OuterJoinLoadable persister, LockOptions lockOptions, SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers) throws MappingException { this( persister, 1, lockOptions, factory, loadQueryInfluencers ); }
public EntityLoader( OuterJoinLoadable persister, String[] uniqueKey, Type uniqueKeyType, int batchSize, LockMode lockMode, SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers) throws MappingException { super( persister, uniqueKeyType, factory, loadQueryInfluencers ); EntityJoinWalker walker = new EntityJoinWalker( persister, uniqueKey, batchSize, lockMode, factory, loadQueryInfluencers ); initFromWalker( walker ); this.compositeKeyManyToOneTargetIndices = walker.getCompositeKeyManyToOneTargetIndices(); postInstantiate(); batchLoader = batchSize > 1; if ( LOG.isDebugEnabled() ) { LOG.debugf( "Static select for entity %s [%s]: %s", entityName, lockMode, getSQLString() ); } }
public EntityLoader( OuterJoinLoadable persister, String[] uniqueKey, Type uniqueKeyType, int batchSize, LockOptions lockOptions, SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers) throws MappingException { super( persister, uniqueKeyType, factory, loadQueryInfluencers ); EntityJoinWalker walker = new EntityJoinWalker( persister, uniqueKey, batchSize, lockOptions, factory, loadQueryInfluencers ); initFromWalker( walker ); this.compositeKeyManyToOneTargetIndices = walker.getCompositeKeyManyToOneTargetIndices(); postInstantiate(); batchLoader = batchSize > 1; if ( LOG.isDebugEnabled() ) { LOG.debugf( "Static select for entity %s [%s:%s]: %s", entityName, lockOptions.getLockMode(), lockOptions.getTimeOut(), getSQLString() ); } }
@Override protected UniqueEntityLoader buildBatchingLoader( OuterJoinLoadable persister, int batchSize, LockMode lockMode, SessionFactoryImplementor factory, LoadQueryInfluencers influencers) { return new DynamicBatchingEntityLoader( persister, batchSize, lockMode, factory, influencers ); }
@Override protected UniqueEntityLoader buildBatchingLoader( OuterJoinLoadable persister, int batchSize, LockOptions lockOptions, SessionFactoryImplementor factory, LoadQueryInfluencers influencers) { return new DynamicBatchingEntityLoader( persister, batchSize, lockOptions, factory, influencers ); }
public DynamicBatchingEntityLoader( OuterJoinLoadable persister, int maxBatchSize, LockMode lockMode, SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers) { super( persister ); this.maxBatchSize = maxBatchSize; this.singleKeyLoader = new EntityLoader( persister, 1, lockMode, factory, loadQueryInfluencers ); this.dynamicLoader = new DynamicEntityLoader( persister, maxBatchSize, lockMode, factory, loadQueryInfluencers ); }
public DynamicBatchingEntityLoader( OuterJoinLoadable persister, int maxBatchSize, LockOptions lockOptions, SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers) { super( persister ); this.maxBatchSize = maxBatchSize; this.singleKeyLoader = new EntityLoader( persister, 1, lockOptions, factory, loadQueryInfluencers ); this.dynamicLoader = new DynamicEntityLoader( persister, maxBatchSize, lockOptions, factory, loadQueryInfluencers ); }
public DynamicEntityLoader( OuterJoinLoadable persister, int maxBatchSize, LockOptions lockOptions, SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers) { this( persister, maxBatchSize, lockOptions.getLockMode(), factory, loadQueryInfluencers ); }
public DynamicEntityLoader( OuterJoinLoadable persister, int maxBatchSize, LockMode lockMode, SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers) { super( persister, -1, lockMode, factory, loadQueryInfluencers ); EntityJoinWalker walker = new EntityJoinWalker( persister, persister.getIdentifierColumnNames(), -1, lockMode, factory, loadQueryInfluencers ) { @Override protected StringBuilder whereString(String alias, String[] columnNames, int batchSize) { return StringHelper.buildBatchFetchRestrictionFragment( alias, columnNames, getFactory().getDialect() ); } }; initFromWalker( walker ); this.sqlTemplate = walker.getSQLString(); this.alias = walker.getAlias(); postInstantiate(); if ( LOG.isDebugEnabled() ) { LOG.debugf( "SQL-template for dynamic entity [%s] batch-fetching [%s] : %s", entityName, lockMode, sqlTemplate ); } }