public boolean isCollection() { return joinableType.isCollectionType(); }
@Override protected boolean isJoinedFetchEnabled(AssociationType type, FetchMode config, CascadeStyle cascadeStyle) { return ( type.isEntityType() || type.isCollectionType() ) && ( cascadeStyle == null || cascadeStyle.doCascade( cascadeAction ) ); }
@Override public AssociationNature getAssociationNature() { if ( getType().isAnyType() ) { return AssociationNature.ANY; } else { if ( getType().isCollectionType() ) { return AssociationNature.COLLECTION; } else { return AssociationNature.ENTITY; } } }
if ( joinWithCompositeId.getJoinableType().isCollectionType() ) { entityPersister = ( ( QueryableCollection) joinWithCompositeId.getJoinable() ).getElementPersister();
public void associationProcessed(OuterJoinableAssociation oja, int position) { associationsByAlias.put( oja.getRhsAlias(), oja ); positionsByAlias.put( oja.getRhsAlias(), position ); EntityPersister entityPersister = null; if ( oja.getJoinableType().isCollectionType() ) { entityPersister = ( ( QueryableCollection) oja.getJoinable() ).getElementPersister(); } else if ( oja.getJoinableType().isEntityType() ) { entityPersister = ( EntityPersister ) oja.getJoinable(); } if ( entityPersister != null && entityPersister.getIdentifierType().isComponentType() && ! entityPersister.getEntityMetamodel().getIdentifierProperty().isEmbedded() && hasAssociation( (CompositeType) entityPersister.getIdentifierType() ) ) { aliasesForAssociationsWithCompositesIds.add( oja.getRhsAlias() ); } }
/** * Does the mapping, and Hibernate default semantics, specify that * this association should be fetched by outer joining */ protected boolean isJoinedFetchEnabledInMapping(FetchMode config, AssociationType type) throws MappingException { if ( !type.isEntityType() && !type.isCollectionType() ) { return false; } else { if ( config == FetchMode.JOIN ) { return true; } if ( config == FetchMode.SELECT ) { return false; } if ( type.isEntityType() ) { //TODO: look at the owning property and check that it // isn't lazy (by instrumentation) EntityType entityType = (EntityType) type; EntityPersister persister = getFactory().getEntityPersister( entityType.getAssociatedEntityName() ); return !persister.hasProxy(); } else { return false; } } }
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 ); }
AssociationType type, SessionFactoryImplementor sessionFactory) { if ( !type.isEntityType() && !type.isCollectionType() ) { return FetchStyle.SELECT;
protected FetchStrategy adjustJoinFetchIfNeeded( AssociationAttributeDefinition attributeDefinition, FetchStrategy fetchStrategy) { if ( lockMode.greaterThan( LockMode.READ ) ) { return new FetchStrategy( fetchStrategy.getTiming(), FetchStyle.SELECT ); } final Integer maxFetchDepth = sessionFactory().getSettings().getMaximumFetchDepth(); if ( maxFetchDepth != null && currentDepth() > maxFetchDepth ) { return new FetchStrategy( fetchStrategy.getTiming(), FetchStyle.SELECT ); } if ( attributeDefinition.getType().isCollectionType() && isTooManyCollections() ) { // todo : have this revert to batch or subselect fetching once "sql gen redesign" is in place return new FetchStrategy( fetchStrategy.getTiming(), FetchStyle.SELECT ); } return fetchStrategy; }
return JoinType.NONE; if ( isTooDeep( currentDepth ) || ( associationType.isCollectionType() && isTooManyCollections() ) ) { return JoinType.NONE;
/** * If required by this strategy, returns a different {@link FetchStrategy} from what is specified * for the given association attribute. * * @param attributeDefinition The association attribute definition. * @param fetchStrategy The fetch strategy for <code>attributeDefinition</code>. * @return the {@link FetchStrategy}, possibly adjusted by this strategy. */ protected FetchStrategy adjustJoinFetchIfNeeded( AssociationAttributeDefinition attributeDefinition, FetchStrategy fetchStrategy) { if ( lockMode.greaterThan( LockMode.READ ) ) { return new FetchStrategy( fetchStrategy.getTiming(), FetchStyle.SELECT ); } final Integer maxFetchDepth = sessionFactory().getSessionFactoryOptions().getMaximumFetchDepth(); if ( maxFetchDepth != null && currentDepth() > maxFetchDepth ) { return new FetchStrategy( fetchStrategy.getTiming(), FetchStyle.SELECT ); } if ( attributeDefinition.getType().isCollectionType() && isTooManyCollections() ) { // todo : have this revert to batch or subselect fetching once "sql gen redesign" is in place return new FetchStrategy( fetchStrategy.getTiming(), FetchStyle.SELECT ); } return fetchStrategy; }
resolvedJoinType = JoinType.NONE; else if ( isTooDeep( currentDepth ) || ( associationType.isCollectionType() && isTooManyCollections() ) ) { resolvedJoinType = JoinType.NONE;
public boolean isCollection() { return joinableType.isCollectionType(); }
public boolean isCollection() { return joinableType.isCollectionType(); }
public boolean isCollection() { return joinableType.isCollectionType(); }
public boolean isCollection() { return joinableType.isCollectionType(); }
@Override protected boolean isJoinedFetchEnabled(AssociationType type, FetchMode config, CascadeStyle cascadeStyle) { return ( type.isEntityType() || type.isCollectionType() ) && ( cascadeStyle==null || cascadeStyle.doCascade(cascadeAction) ); }
@Override protected boolean isJoinedFetchEnabled(AssociationType type, FetchMode config, CascadeStyle cascadeStyle) { return ( type.isEntityType() || type.isCollectionType() ) && ( cascadeStyle==null || cascadeStyle.doCascade(cascadeAction) ); }
protected boolean isJoinedFetchEnabled(AssociationType type, FetchMode config, CascadeStyle cascadeStyle) { return ( type.isEntityType() || type.isCollectionType() ) && ( cascadeStyle==null || cascadeStyle.doCascade(cascadeAction) ); }
public void associationProcessed(OuterJoinableAssociation oja, int position) { associationsByAlias.put( oja.getRhsAlias(), oja ); positionsByAlias.put( oja.getRhsAlias(), position ); EntityPersister entityPersister = null; if ( oja.getJoinableType().isCollectionType() ) { entityPersister = ( ( QueryableCollection) oja.getJoinable() ).getElementPersister(); } else if ( oja.getJoinableType().isEntityType() ) { entityPersister = ( EntityPersister ) oja.getJoinable(); } if ( entityPersister != null && entityPersister.getIdentifierType().isComponentType() && ! entityPersister.getEntityMetamodel().getIdentifierProperty().isEmbedded() && hasAssociation( (CompositeType) entityPersister.getIdentifierType() ) ) { aliasesForAssociationsWithCompositesIds.add( oja.getRhsAlias() ); } }