String lhsTable = JoinHelper.getLHSTableName( associationType, propertyNumber, persister ); PropertyPath subPath = path.append( persister.getSubclassPropertyName( propertyNumber ) ); JoinType joinType = getJoinType( persister, propertyNumber, associationType, persister.getFetchMode( propertyNumber ), persister.getCascadeStyle( propertyNumber ), lhsTable, lhsColumns,
if ( type.useLHSPrimaryKey() ) { return lhsPersister.getIdentifierColumnNames(); ? lhsPersister.getIdentifierColumnNames() : lhsPersister.getSubclassPropertyColumnNames( property ), begin, type.getColumnSpan( mapping ) return lhsPersister.getPropertyColumnNames( propertyName );
final PropertyPath path, final int currentDepth) throws MappingException { int n = persister.countSubclassProperties(); for ( int i = 0; i < n; i++ ) { Type type = persister.getSubclassPropertyType( i ); if ( type.isAssociationType() ) { walkEntityAssociationTree( alias, path, persister.isSubclassPropertyNullable( i ), currentDepth ); persister, alias, path.append( persister.getSubclassPropertyName( i ) ), currentDepth ); final Type idType = persister.getIdentifierType(); if ( idType.isComponentType() ) { final CompositeType cidType = (CompositeType) idType; if ( persister.getEntityMetamodel().getIdentifierProperty().isEmbedded() ) { walkComponentTree( cidType,
public EntityLoader( OuterJoinLoadable persister, int batchSize, LockMode lockMode, SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers) throws MappingException { this( persister, persister.getIdentifierColumnNames(), persister.getIdentifierType(), batchSize, lockMode, factory, loadQueryInfluencers ); }
private static String[] toColumns(OuterJoinLoadable persister, String columnQualifier, int propertyIndex) { if ( propertyIndex >= 0 ) { return persister.toColumns( columnQualifier, propertyIndex ); } else { final String[] cols = persister.getIdentifierColumnNames(); final String[] result = new String[cols.length]; for ( int j = 0; j < cols.length; j++ ) { result[j] = StringHelper.qualify( columnQualifier, cols[j] ); } return result; } }
public CascadeEntityJoinWalker( OuterJoinLoadable persister, CascadingAction action, SessionFactoryImplementor factory) throws MappingException { super( persister, factory, LoadQueryInfluencers.NONE ); this.cascadeAction = action; StringBuilder whereCondition = whereString( getAlias(), persister.getIdentifierColumnNames(), 1 ) //include the discriminator and class-level where, but not filters .append( persister.filterFragment( getAlias(), Collections.EMPTY_MAP ) ); initAll( whereCondition.toString(), "", LockOptions.READ ); }
throws MappingException { int n = persister.countSubclassProperties(); for ( int i=0; i<n; i++ ) { Type type = persister.getSubclassPropertyType(i); if ( type.isAssociationType() ) { walkEntityAssociationTree( alias, path, persister.isSubclassPropertyNullable(i), currentDepth ); persister, alias, subPath( path, persister.getSubclassPropertyName(i) ), currentDepth );
.setSelectClause( projection == null ? persister.selectFragment( alias, suffixes[joins] ) + selectString( associations ) : projection getDialect().appendLockHint( lockOptions, persister.fromTableFragment( alias ) ) + persister.fromJoinFragment( alias, true, true )
elementPersister.fromTableFragment( alias ) + elementPersister.fromJoinFragment( alias, true, true ) ojf.toFromFragmentString(), ojf.toWhereFragmentString() + elementPersister.whereJoinFragment( alias, true, true ) );
public AbstractEntityLoader( OuterJoinLoadable persister, Type uniqueKeyType, SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers) { super( factory, loadQueryInfluencers ); this.uniqueKeyType = uniqueKeyType; this.entityName = persister.getEntityName(); this.persister = persister; }
@Override protected void applyRootReturnTableFragments(SelectStatementBuilder selectStatementBuilder) { final OuterJoinLoadable elementOuterJoinLoadable = (OuterJoinLoadable) getElementEntityReference().getEntityPersister(); //final String tableAlias = getCollectionReferenceAliases().getCollectionTableAlias(); final String tableAlias = getElementEntityReferenceAliases().getTableAlias(); final String fragment = elementOuterJoinLoadable.fromTableFragment( tableAlias ) + elementOuterJoinLoadable.fromJoinFragment( tableAlias, true, true); selectStatementBuilder.appendFromClauseFragment( fragment ); }
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; }
public static QueryParameters buildMultiLoadQueryParameters( OuterJoinLoadable persister, Serializable[] ids, LockOptions lockOptions) { Type[] types = new Type[ids.length]; Arrays.fill( types, persister.getIdentifierType() ); QueryParameters qp = new QueryParameters(); qp.setOptionalEntityName( persister.getEntityName() ); qp.setPositionalParameterTypes( types ); qp.setPositionalParameterValues( ids ); qp.setLockOptions( lockOptions ); qp.setOptionalObject( null ); qp.setOptionalId( null ); return qp; }
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(); }
protected final void initAll( final String whereString, final String orderByString, final LockOptions lockOptions, final AssociationInitCallback callback) throws MappingException { walkEntityTree( persister, getAlias() ); List allAssociations = new ArrayList(); allAssociations.addAll( associations ); allAssociations.add( OuterJoinableAssociation.createRoot( persister.getEntityType(), alias, getFactory() ) ); initPersisters( allAssociations, lockOptions, callback ); initStatementString( whereString, orderByString, lockOptions ); }
String lhsTable = JoinHelper.getLHSTableName(associationType, propertyNumber, persister); String subpath = subPath( path, persister.getSubclassPropertyName(propertyNumber) ); int joinType = getJoinType( associationType, persister.getFetchMode(propertyNumber), subpath, visitedAssociations,
persister.getIdentifierColumnNames(), -1, lockMode,
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() ); } }
this.entityName = persister.getEntityName(); this.lockMode = lockMode; .append( persister.filterFragment( getAlias(), Collections.EMPTY_MAP ) );
private org.hibernate.FetchMode determineFetchMode(Class<?> entityClass, String path) { OuterJoinLoadable entityPersister = (OuterJoinLoadable) sessionFactory().getEntityPersister( entityClass.getName() ); int index = ( (UniqueKeyLoadable) entityPersister ).getPropertyIndex( path ); return entityPersister.getFetchMode( index ); }