HHH-8722 HHH-8723 : Reorg AbstractLoadPlanBuildingAssociationVisitationStrategy and add Any support
This commit is contained in:
parent
7693826b77
commit
9d8fa394e3
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2013, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.loader.plan2.build.internal.returns;
|
||||
|
||||
import org.hibernate.loader.PropertyPath;
|
||||
import org.hibernate.loader.plan2.spi.BidirectionalEntityReference;
|
||||
import org.hibernate.loader.plan2.spi.Fetch;
|
||||
import org.hibernate.loader.plan2.spi.FetchSource;
|
||||
|
||||
/**
|
||||
* @author Gail Badner
|
||||
*/
|
||||
public abstract class AbstractAnyReference implements FetchSource {
|
||||
/**
|
||||
* Convenient constant for returning no fetches from {@link #getFetches()}
|
||||
*/
|
||||
private static final Fetch[] NO_FETCHES = new Fetch[0];
|
||||
|
||||
/**
|
||||
* Convenient constant for returning no fetches from {@link #getFetches()}
|
||||
*/
|
||||
private static final BidirectionalEntityReference[] NO_BIDIRECTIONAL_ENTITY_REFERENCES =
|
||||
new BidirectionalEntityReference[0];
|
||||
|
||||
private final PropertyPath propertyPath;
|
||||
|
||||
public AbstractAnyReference(PropertyPath propertyPath) {
|
||||
this.propertyPath = propertyPath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PropertyPath getPropertyPath() {
|
||||
return propertyPath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fetch[] getFetches() {
|
||||
return NO_FETCHES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BidirectionalEntityReference[] getBidirectionalEntityReferences() {
|
||||
return NO_BIDIRECTIONAL_ENTITY_REFERENCES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQuerySpaceUid() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -84,6 +84,9 @@ public abstract class AbstractCollectionReference implements CollectionReference
|
|||
);
|
||||
return new CollectionFetchableIndexEntityGraph( this, entityQuerySpace );
|
||||
}
|
||||
else if ( type.isAnyType() ) {
|
||||
return new CollectionFetchableIndexAnyGraph( this );
|
||||
}
|
||||
}
|
||||
else if ( type.isComponentType() ) {
|
||||
final ExpandingCompositeQuerySpace compositeQuerySpace = QuerySpaceHelper.INSTANCE.makeCompositeQuerySpace(
|
||||
|
@ -127,6 +130,9 @@ public abstract class AbstractCollectionReference implements CollectionReference
|
|||
);
|
||||
return new CollectionFetchableElementEntityGraph( this, entityQuerySpace );
|
||||
}
|
||||
else if ( type.isAnyType() ) {
|
||||
return new CollectionFetchableElementAnyGraph( this );
|
||||
}
|
||||
}
|
||||
else if ( type.isComponentType() ) {
|
||||
final ExpandingCompositeQuerySpace compositeQuerySpace = QuerySpaceHelper.INSTANCE.makeCompositeQuerySpace(
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.hibernate.loader.plan2.build.spi.ExpandingEntityIdentifierDescription
|
|||
import org.hibernate.loader.plan2.spi.EntityReference;
|
||||
import org.hibernate.loader.plan2.spi.FetchSource;
|
||||
import org.hibernate.type.CompositeType;
|
||||
import org.hibernate.type.Type;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
|
@ -36,17 +37,19 @@ import org.hibernate.type.CompositeType;
|
|||
*/
|
||||
public abstract class AbstractCompositeEntityIdentifierDescription
|
||||
extends AbstractCompositeFetch
|
||||
implements FetchSource, ExpandingEntityIdentifierDescription {
|
||||
implements ExpandingEntityIdentifierDescription {
|
||||
|
||||
private final EntityReference entityReference;
|
||||
private final CompositeType identifierType;
|
||||
|
||||
protected AbstractCompositeEntityIdentifierDescription(
|
||||
EntityReference entityReference,
|
||||
ExpandingCompositeQuerySpace compositeQuerySpace,
|
||||
CompositeType identifierType,
|
||||
PropertyPath propertyPath) {
|
||||
super( identifierType, compositeQuerySpace, false, propertyPath );
|
||||
super( compositeQuerySpace, false, propertyPath );
|
||||
this.entityReference = entityReference;
|
||||
this.identifierType = identifierType;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -64,4 +67,20 @@ public abstract class AbstractCompositeEntityIdentifierDescription
|
|||
// the source for this (as a Fetch) is the entity reference
|
||||
return entityReference;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type getFetchedType() {
|
||||
return identifierType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNullable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityReference resolveEntityReference() {
|
||||
return entityReference;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -28,90 +28,20 @@ import org.hibernate.engine.FetchStyle;
|
|||
import org.hibernate.engine.FetchTiming;
|
||||
import org.hibernate.loader.PropertyPath;
|
||||
import org.hibernate.loader.plan2.build.spi.ExpandingCompositeQuerySpace;
|
||||
import org.hibernate.loader.plan2.spi.CollectionFetch;
|
||||
import org.hibernate.loader.plan2.spi.CompositeFetch;
|
||||
import org.hibernate.loader.plan2.spi.EntityReference;
|
||||
import org.hibernate.loader.plan2.spi.FetchSource;
|
||||
import org.hibernate.persister.walking.spi.AssociationAttributeDefinition;
|
||||
import org.hibernate.persister.walking.spi.AttributeDefinition;
|
||||
import org.hibernate.persister.walking.spi.CompositionDefinition;
|
||||
import org.hibernate.persister.walking.spi.WalkingException;
|
||||
import org.hibernate.type.CompositeType;
|
||||
import org.hibernate.type.Type;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
* @author Gail Badner
|
||||
*/
|
||||
public abstract class AbstractCompositeFetch extends AbstractExpandingFetchSource implements CompositeFetch {
|
||||
public abstract class AbstractCompositeFetch extends AbstractCompositeReference implements CompositeFetch {
|
||||
protected static final FetchStrategy FETCH_STRATEGY = new FetchStrategy( FetchTiming.IMMEDIATE, FetchStyle.JOIN );
|
||||
|
||||
private final CompositeType compositeType;
|
||||
private final boolean allowCollectionFetches;
|
||||
|
||||
protected AbstractCompositeFetch(
|
||||
CompositeType compositeType,
|
||||
ExpandingCompositeQuerySpace compositeQuerySpace,
|
||||
boolean allowCollectionFetches,
|
||||
PropertyPath propertyPath) {
|
||||
super( compositeQuerySpace, propertyPath );
|
||||
this.compositeType = compositeType;
|
||||
this.allowCollectionFetches = allowCollectionFetches;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityReference resolveEntityReference() {
|
||||
return resolveFetchSourceEntityReference( this );
|
||||
}
|
||||
|
||||
private static EntityReference resolveFetchSourceEntityReference(CompositeFetch fetch) {
|
||||
final FetchSource fetchSource = fetch.getSource();
|
||||
|
||||
if ( EntityReference.class.isInstance( fetchSource ) ) {
|
||||
return (EntityReference) fetchSource;
|
||||
}
|
||||
else if ( CompositeFetch.class.isInstance( fetchSource ) ) {
|
||||
return resolveFetchSourceEntityReference( (CompositeFetch) fetchSource );
|
||||
}
|
||||
throw new IllegalStateException(
|
||||
String.format(
|
||||
"Cannot resolve FetchOwner [%s] of Fetch [%s (%s)] to an EntityReference",
|
||||
fetchSource,
|
||||
fetch,
|
||||
fetch.getPropertyPath()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateFetchPlan(FetchStrategy fetchStrategy, AttributeDefinition attributeDefinition) {
|
||||
// anything to do here?
|
||||
}
|
||||
|
||||
protected CompositeFetch createCompositeFetch(
|
||||
AttributeDefinition attributeDefinition,
|
||||
ExpandingCompositeQuerySpace compositeQuerySpace) {
|
||||
return new NestedCompositeFetchImpl(
|
||||
this,
|
||||
attributeDefinition,
|
||||
compositeQuerySpace,
|
||||
allowCollectionFetches
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CollectionFetch buildCollectionFetch(
|
||||
AssociationAttributeDefinition attributeDefinition,
|
||||
FetchStrategy fetchStrategy) {
|
||||
if ( !allowCollectionFetches ) {
|
||||
throw new WalkingException(
|
||||
String.format(
|
||||
"This composite path [%s] does not allow collection fetches (composite id or composite collection index/element",
|
||||
getPropertyPath().getFullPath()
|
||||
)
|
||||
);
|
||||
}
|
||||
return super.buildCollectionFetch( attributeDefinition, fetchStrategy );
|
||||
super( compositeQuerySpace, allowCollectionFetches, propertyPath );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -119,16 +49,6 @@ public abstract class AbstractCompositeFetch extends AbstractExpandingFetchSourc
|
|||
return FETCH_STRATEGY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type getFetchedType() {
|
||||
return compositeType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNullable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAdditionalJoinConditions() {
|
||||
return null;
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2013, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.loader.plan2.build.internal.returns;
|
||||
|
||||
import org.hibernate.engine.FetchStrategy;
|
||||
import org.hibernate.loader.PropertyPath;
|
||||
import org.hibernate.loader.plan2.build.spi.ExpandingCompositeQuerySpace;
|
||||
import org.hibernate.loader.plan2.spi.CollectionAttributeFetch;
|
||||
import org.hibernate.loader.plan2.spi.CompositeAttributeFetch;
|
||||
import org.hibernate.persister.walking.spi.AssociationAttributeDefinition;
|
||||
import org.hibernate.persister.walking.spi.AttributeDefinition;
|
||||
import org.hibernate.persister.walking.spi.WalkingException;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
* @author Gail Badner
|
||||
*/
|
||||
public abstract class AbstractCompositeReference extends AbstractExpandingFetchSource {
|
||||
|
||||
private final boolean allowCollectionFetches;
|
||||
|
||||
protected AbstractCompositeReference(
|
||||
ExpandingCompositeQuerySpace compositeQuerySpace,
|
||||
boolean allowCollectionFetches,
|
||||
PropertyPath propertyPath) {
|
||||
super( compositeQuerySpace, propertyPath );
|
||||
this.allowCollectionFetches = allowCollectionFetches;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateFetchPlan(FetchStrategy fetchStrategy, AttributeDefinition attributeDefinition) {
|
||||
// anything to do here?
|
||||
}
|
||||
|
||||
protected CompositeAttributeFetch createCompositeAttributeFetch(
|
||||
AttributeDefinition attributeDefinition,
|
||||
ExpandingCompositeQuerySpace compositeQuerySpace) {
|
||||
return new NestedCompositeAttributeFetchImpl(
|
||||
this,
|
||||
attributeDefinition,
|
||||
compositeQuerySpace,
|
||||
allowCollectionFetches
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CollectionAttributeFetch buildCollectionAttributeFetch(
|
||||
AssociationAttributeDefinition attributeDefinition,
|
||||
FetchStrategy fetchStrategy) {
|
||||
if ( !allowCollectionFetches ) {
|
||||
throw new WalkingException(
|
||||
String.format(
|
||||
"This composite path [%s] does not allow collection fetches (composite id or composite collection index/element",
|
||||
getPropertyPath().getFullPath()
|
||||
)
|
||||
);
|
||||
}
|
||||
return super.buildCollectionAttributeFetch( attributeDefinition, fetchStrategy );
|
||||
}
|
||||
}
|
|
@ -26,12 +26,11 @@ package org.hibernate.loader.plan2.build.internal.returns;
|
|||
import org.hibernate.loader.PropertyPath;
|
||||
import org.hibernate.loader.plan2.build.spi.ExpandingCompositeQuerySpace;
|
||||
import org.hibernate.loader.plan2.build.spi.ExpandingEntityQuerySpace;
|
||||
import org.hibernate.loader.plan2.spi.CompositeFetch;
|
||||
import org.hibernate.loader.plan2.spi.CompositeAttributeFetch;
|
||||
import org.hibernate.loader.plan2.spi.EntityIdentifierDescription;
|
||||
import org.hibernate.loader.plan2.spi.EntityReference;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.persister.walking.spi.AttributeDefinition;
|
||||
import org.hibernate.persister.walking.spi.CompositionDefinition;
|
||||
import org.hibernate.persister.walking.spi.EncapsulatedEntityIdentifierDefinition;
|
||||
import org.hibernate.persister.walking.spi.EntityIdentifierDefinition;
|
||||
import org.hibernate.type.CompositeType;
|
||||
|
@ -114,10 +113,10 @@ public abstract class AbstractEntityReference extends AbstractExpandingFetchSour
|
|||
return identifierDescription;
|
||||
}
|
||||
|
||||
protected CompositeFetch createCompositeFetch(
|
||||
protected CompositeAttributeFetch createCompositeAttributeFetch(
|
||||
AttributeDefinition attributeDefinition,
|
||||
ExpandingCompositeQuerySpace compositeQuerySpace) {
|
||||
return new CompositeFetchImpl(
|
||||
return new CompositeAttributeFetchImpl(
|
||||
this,
|
||||
attributeDefinition,
|
||||
compositeQuerySpace,
|
||||
|
|
|
@ -35,10 +35,10 @@ import org.hibernate.loader.plan2.build.spi.ExpandingEntityQuerySpace;
|
|||
import org.hibernate.loader.plan2.build.spi.ExpandingFetchSource;
|
||||
import org.hibernate.loader.plan2.build.spi.ExpandingQuerySpace;
|
||||
import org.hibernate.loader.plan2.build.spi.ExpandingQuerySpaces;
|
||||
import org.hibernate.loader.plan2.spi.AnyFetch;
|
||||
import org.hibernate.loader.plan2.spi.AnyAttributeFetch;
|
||||
import org.hibernate.loader.plan2.spi.BidirectionalEntityReference;
|
||||
import org.hibernate.loader.plan2.spi.CollectionFetch;
|
||||
import org.hibernate.loader.plan2.spi.CompositeFetch;
|
||||
import org.hibernate.loader.plan2.spi.CollectionAttributeFetch;
|
||||
import org.hibernate.loader.plan2.spi.CompositeAttributeFetch;
|
||||
import org.hibernate.loader.plan2.spi.EntityFetch;
|
||||
import org.hibernate.loader.plan2.spi.EntityReference;
|
||||
import org.hibernate.loader.plan2.spi.Fetch;
|
||||
|
@ -116,7 +116,7 @@ public abstract class AbstractExpandingFetchSource implements ExpandingFetchSour
|
|||
}
|
||||
|
||||
@Override
|
||||
public EntityFetch buildEntityFetch(
|
||||
public EntityFetch buildEntityAttributeFetch(
|
||||
AssociationAttributeDefinition attributeDefinition,
|
||||
FetchStrategy fetchStrategy) {
|
||||
|
||||
|
@ -126,7 +126,7 @@ public abstract class AbstractExpandingFetchSource implements ExpandingFetchSour
|
|||
getQuerySpaces().generateImplicitUid(),
|
||||
fetchStrategy
|
||||
);
|
||||
final EntityFetch fetch = new EntityFetchImpl( this, attributeDefinition, fetchStrategy, entityQuerySpace );
|
||||
final EntityFetch fetch = new EntityAttributeFetchImpl( this, attributeDefinition, fetchStrategy, entityQuerySpace );
|
||||
addFetch( fetch );
|
||||
return fetch;
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ public abstract class AbstractExpandingFetchSource implements ExpandingFetchSour
|
|||
return bidirectionalEntityReference;
|
||||
}
|
||||
|
||||
protected abstract CompositeFetch createCompositeFetch(
|
||||
protected abstract CompositeAttributeFetch createCompositeAttributeFetch(
|
||||
AttributeDefinition compositeType,
|
||||
ExpandingCompositeQuerySpace compositeQuerySpace);
|
||||
|
||||
|
@ -164,7 +164,7 @@ public abstract class AbstractExpandingFetchSource implements ExpandingFetchSour
|
|||
}
|
||||
|
||||
@Override
|
||||
public CompositeFetch buildCompositeFetch(
|
||||
public CompositeAttributeFetch buildCompositeAttributeFetch(
|
||||
AttributeDefinition attributeDefinition) {
|
||||
final ExpandingCompositeQuerySpace compositeQuerySpace = QuerySpaceHelper.INSTANCE.makeCompositeQuerySpace(
|
||||
expandingQuerySpace(),
|
||||
|
@ -173,13 +173,13 @@ public abstract class AbstractExpandingFetchSource implements ExpandingFetchSour
|
|||
true
|
||||
);
|
||||
|
||||
final CompositeFetch fetch = createCompositeFetch( attributeDefinition, compositeQuerySpace );
|
||||
final CompositeAttributeFetch fetch = createCompositeAttributeFetch( attributeDefinition, compositeQuerySpace );
|
||||
addFetch( fetch );
|
||||
return fetch;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CollectionFetch buildCollectionFetch(
|
||||
public CollectionAttributeFetch buildCollectionAttributeFetch(
|
||||
AssociationAttributeDefinition attributeDefinition,
|
||||
FetchStrategy fetchStrategy) {
|
||||
|
||||
|
@ -190,7 +190,7 @@ public abstract class AbstractExpandingFetchSource implements ExpandingFetchSour
|
|||
fetchStrategy
|
||||
);
|
||||
|
||||
final CollectionFetch fetch = new CollectionFetchImpl(
|
||||
final CollectionAttributeFetch fetch = new CollectionAttributeFetchImpl(
|
||||
this,
|
||||
attributeDefinition,
|
||||
fetchStrategy,
|
||||
|
@ -201,11 +201,11 @@ public abstract class AbstractExpandingFetchSource implements ExpandingFetchSour
|
|||
}
|
||||
|
||||
@Override
|
||||
public AnyFetch buildAnyFetch(
|
||||
AssociationAttributeDefinition attributeDefinition,
|
||||
FetchStrategy fetchStrategy) {
|
||||
public AnyAttributeFetch buildAnyAttributeFetch(
|
||||
AssociationAttributeDefinition attributeDefinition,
|
||||
FetchStrategy fetchStrategy) {
|
||||
|
||||
final AnyFetch fetch = new AnyFetchImpl(
|
||||
final AnyAttributeFetch fetch = new AnyAttributeFetchImpl(
|
||||
this,
|
||||
attributeDefinition,
|
||||
fetchStrategy
|
||||
|
|
|
@ -24,11 +24,9 @@
|
|||
package org.hibernate.loader.plan2.build.internal.returns;
|
||||
|
||||
import org.hibernate.engine.FetchStrategy;
|
||||
import org.hibernate.loader.PropertyPath;
|
||||
import org.hibernate.loader.plan2.spi.AnyFetch;
|
||||
import org.hibernate.loader.plan2.spi.BidirectionalEntityReference;
|
||||
import org.hibernate.loader.plan2.spi.AnyAttributeFetch;
|
||||
import org.hibernate.loader.plan2.spi.AttributeFetch;
|
||||
import org.hibernate.loader.plan2.spi.EntityReference;
|
||||
import org.hibernate.loader.plan2.spi.Fetch;
|
||||
import org.hibernate.loader.plan2.spi.FetchSource;
|
||||
import org.hibernate.persister.walking.spi.AssociationAttributeDefinition;
|
||||
import org.hibernate.persister.walking.spi.AttributeDefinition;
|
||||
|
@ -38,34 +36,20 @@ import org.hibernate.type.AnyType;
|
|||
* @author Steve Ebersole
|
||||
* @author Gail Badner
|
||||
*/
|
||||
public class AnyFetchImpl implements AnyFetch {
|
||||
/**
|
||||
* Convenient constant for returning no fetches from {@link #getFetches()}
|
||||
*/
|
||||
private static final Fetch[] NO_FETCHES = new Fetch[0];
|
||||
|
||||
/**
|
||||
* Convenient constant for returning no fetches from {@link #getFetches()}
|
||||
*/
|
||||
private static final BidirectionalEntityReference[] NO_BIDIRECTIONAL_ENTITY_REFERENCES =
|
||||
new BidirectionalEntityReference[0];
|
||||
|
||||
|
||||
public class AnyAttributeFetchImpl extends AbstractAnyReference implements AnyAttributeFetch, AttributeFetch {
|
||||
private final FetchSource fetchSource;
|
||||
private final AssociationAttributeDefinition fetchedAttribute;
|
||||
private final FetchStrategy fetchStrategy;
|
||||
|
||||
private final PropertyPath propertyPath;
|
||||
|
||||
public AnyFetchImpl(
|
||||
public AnyAttributeFetchImpl(
|
||||
FetchSource fetchSource,
|
||||
AssociationAttributeDefinition fetchedAttribute,
|
||||
FetchStrategy fetchStrategy) {
|
||||
super( fetchSource.getPropertyPath().append( fetchedAttribute.getName() ) );
|
||||
|
||||
this.fetchSource = fetchSource;
|
||||
this.fetchedAttribute = fetchedAttribute;
|
||||
this.fetchStrategy = fetchStrategy;
|
||||
this.propertyPath = fetchSource.getPropertyPath().append( fetchedAttribute.getName() );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -73,6 +57,11 @@ public class AnyFetchImpl implements AnyFetch {
|
|||
return fetchSource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FetchStrategy getFetchStrategy() {
|
||||
return fetchStrategy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnyType getFetchedType() {
|
||||
return (AnyType) fetchedAttribute.getType();
|
||||
|
@ -94,31 +83,6 @@ public class AnyFetchImpl implements AnyFetch {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FetchStrategy getFetchStrategy() {
|
||||
return fetchStrategy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PropertyPath getPropertyPath() {
|
||||
return propertyPath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQuerySpaceUid() {
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fetch[] getFetches() {
|
||||
return NO_FETCHES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BidirectionalEntityReference[] getBidirectionalEntityReferences() {
|
||||
return NO_BIDIRECTIONAL_ENTITY_REFERENCES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityReference resolveEntityReference() {
|
||||
return fetchSource.resolveEntityReference();
|
|
@ -27,7 +27,7 @@ import org.hibernate.engine.FetchStrategy;
|
|||
import org.hibernate.loader.plan2.build.internal.spaces.QuerySpaceHelper;
|
||||
import org.hibernate.loader.plan2.build.spi.ExpandingCollectionQuerySpace;
|
||||
import org.hibernate.loader.plan2.build.spi.ExpandingFetchSource;
|
||||
import org.hibernate.loader.plan2.spi.CollectionFetch;
|
||||
import org.hibernate.loader.plan2.spi.CollectionAttributeFetch;
|
||||
import org.hibernate.loader.plan2.spi.FetchSource;
|
||||
import org.hibernate.persister.walking.spi.AssociationAttributeDefinition;
|
||||
import org.hibernate.persister.walking.spi.AttributeDefinition;
|
||||
|
@ -36,12 +36,12 @@ import org.hibernate.type.CollectionType;
|
|||
/**
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class CollectionFetchImpl extends AbstractCollectionReference implements CollectionFetch {
|
||||
public class CollectionAttributeFetchImpl extends AbstractCollectionReference implements CollectionAttributeFetch {
|
||||
private final ExpandingFetchSource fetchSource;
|
||||
private final AttributeDefinition fetchedAttribute;
|
||||
private final FetchStrategy fetchStrategy;
|
||||
|
||||
public CollectionFetchImpl(
|
||||
public CollectionAttributeFetchImpl(
|
||||
ExpandingFetchSource fetchSource,
|
||||
AssociationAttributeDefinition fetchedAttribute,
|
||||
FetchStrategy fetchStrategy,
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2013, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.loader.plan2.build.internal.returns;
|
||||
|
||||
import org.hibernate.loader.plan2.spi.CollectionFetchableElement;
|
||||
import org.hibernate.loader.plan2.spi.CollectionReference;
|
||||
import org.hibernate.loader.plan2.spi.EntityReference;
|
||||
import org.hibernate.loader.plan2.spi.Fetch;
|
||||
|
||||
/**
|
||||
* @author Gail Badner
|
||||
*/
|
||||
public class CollectionFetchableElementAnyGraph extends AbstractAnyReference implements CollectionFetchableElement {
|
||||
private final CollectionReference collectionReference;
|
||||
|
||||
public CollectionFetchableElementAnyGraph(CollectionReference collectionReference) {
|
||||
super(
|
||||
// this property path is just informational...
|
||||
collectionReference.getPropertyPath().append( "<element>" )
|
||||
);
|
||||
this.collectionReference = collectionReference;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CollectionReference getCollectionReference() {
|
||||
return collectionReference;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityReference resolveEntityReference() {
|
||||
return Fetch.class.isInstance( collectionReference ) ?
|
||||
Fetch.class.cast( collectionReference ).getSource().resolveEntityReference() :
|
||||
null;
|
||||
}
|
||||
}
|
|
@ -26,9 +26,8 @@ package org.hibernate.loader.plan2.build.internal.returns;
|
|||
import org.hibernate.loader.plan2.build.spi.ExpandingCompositeQuerySpace;
|
||||
import org.hibernate.loader.plan2.spi.CollectionFetchableElement;
|
||||
import org.hibernate.loader.plan2.spi.CollectionReference;
|
||||
import org.hibernate.loader.plan2.spi.CompositeFetch;
|
||||
import org.hibernate.loader.plan2.spi.FetchSource;
|
||||
import org.hibernate.type.CompositeType;
|
||||
import org.hibernate.loader.plan2.spi.EntityReference;
|
||||
import org.hibernate.loader.plan2.spi.Fetch;
|
||||
|
||||
/**
|
||||
* Models the element graph of a collection, where the elements are composite
|
||||
|
@ -36,8 +35,8 @@ import org.hibernate.type.CompositeType;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
public class CollectionFetchableElementCompositeGraph
|
||||
extends AbstractCompositeFetch
|
||||
implements CompositeFetch, CollectionFetchableElement {
|
||||
extends AbstractCompositeReference
|
||||
implements CollectionFetchableElement {
|
||||
|
||||
private final CollectionReference collectionReference;
|
||||
|
||||
|
@ -45,7 +44,6 @@ public class CollectionFetchableElementCompositeGraph
|
|||
CollectionReference collectionReference,
|
||||
ExpandingCompositeQuerySpace compositeQuerySpace) {
|
||||
super(
|
||||
(CompositeType) collectionReference.getCollectionPersister().getElementType(),
|
||||
compositeQuerySpace,
|
||||
false,
|
||||
// these property paths are just informational...
|
||||
|
@ -60,7 +58,9 @@ public class CollectionFetchableElementCompositeGraph
|
|||
}
|
||||
|
||||
@Override
|
||||
public FetchSource getSource() {
|
||||
return collectionReference.getElementGraph();
|
||||
public EntityReference resolveEntityReference() {
|
||||
return Fetch.class.isInstance( collectionReference ) ?
|
||||
Fetch.class.cast( collectionReference ).getSource().resolveEntityReference() :
|
||||
null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2013, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.loader.plan2.build.internal.returns;
|
||||
|
||||
import org.hibernate.loader.plan2.spi.CollectionFetchableIndex;
|
||||
import org.hibernate.loader.plan2.spi.CollectionReference;
|
||||
import org.hibernate.loader.plan2.spi.EntityReference;
|
||||
import org.hibernate.loader.plan2.spi.Fetch;
|
||||
|
||||
/**
|
||||
* @author Gail Badner
|
||||
*/
|
||||
public class CollectionFetchableIndexAnyGraph extends AbstractAnyReference implements CollectionFetchableIndex {
|
||||
private final CollectionReference collectionReference;
|
||||
|
||||
public CollectionFetchableIndexAnyGraph(CollectionReference collectionReference) {
|
||||
super(
|
||||
// this property path is just informational...
|
||||
collectionReference.getPropertyPath().append( "<index>" )
|
||||
);
|
||||
this.collectionReference = collectionReference;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CollectionReference getCollectionReference() {
|
||||
return collectionReference;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityReference resolveEntityReference() {
|
||||
return Fetch.class.isInstance( collectionReference ) ?
|
||||
Fetch.class.cast( collectionReference ).getSource().resolveEntityReference() :
|
||||
null;
|
||||
}
|
||||
}
|
|
@ -26,10 +26,8 @@ package org.hibernate.loader.plan2.build.internal.returns;
|
|||
import org.hibernate.loader.plan2.build.spi.ExpandingCompositeQuerySpace;
|
||||
import org.hibernate.loader.plan2.spi.CollectionFetchableIndex;
|
||||
import org.hibernate.loader.plan2.spi.CollectionReference;
|
||||
import org.hibernate.loader.plan2.spi.CompositeFetch;
|
||||
import org.hibernate.loader.plan2.spi.FetchSource;
|
||||
import org.hibernate.type.CompositeType;
|
||||
import org.hibernate.type.Type;
|
||||
import org.hibernate.loader.plan2.spi.EntityReference;
|
||||
import org.hibernate.loader.plan2.spi.Fetch;
|
||||
|
||||
/**
|
||||
* Models the index graph of a collection, where the index are composite. This can only be a Map, where the keys are
|
||||
|
@ -38,8 +36,8 @@ import org.hibernate.type.Type;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
public class CollectionFetchableIndexCompositeGraph
|
||||
extends AbstractCompositeFetch
|
||||
implements CompositeFetch, CollectionFetchableIndex {
|
||||
extends AbstractCompositeReference
|
||||
implements CollectionFetchableIndex {
|
||||
|
||||
private final CollectionReference collectionReference;
|
||||
|
||||
|
@ -47,7 +45,6 @@ public class CollectionFetchableIndexCompositeGraph
|
|||
CollectionReference collectionReference,
|
||||
ExpandingCompositeQuerySpace compositeQuerySpace) {
|
||||
super(
|
||||
(CompositeType) collectionReference.getCollectionPersister().getIndexType(),
|
||||
compositeQuerySpace,
|
||||
false,
|
||||
collectionReference.getPropertyPath().append( "<index>" )
|
||||
|
@ -61,7 +58,9 @@ public class CollectionFetchableIndexCompositeGraph
|
|||
}
|
||||
|
||||
@Override
|
||||
public FetchSource getSource() {
|
||||
return collectionReference.getIndexGraph();
|
||||
public EntityReference resolveEntityReference() {
|
||||
return Fetch.class.isInstance( collectionReference ) ?
|
||||
Fetch.class.cast( collectionReference ).getSource().resolveEntityReference() :
|
||||
null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,24 +25,25 @@ package org.hibernate.loader.plan2.build.internal.returns;
|
|||
|
||||
import org.hibernate.loader.plan2.build.spi.ExpandingCompositeQuerySpace;
|
||||
import org.hibernate.loader.plan2.spi.CompositeAttributeFetch;
|
||||
import org.hibernate.loader.plan2.spi.EntityReference;
|
||||
import org.hibernate.loader.plan2.spi.FetchSource;
|
||||
import org.hibernate.persister.walking.spi.AttributeDefinition;
|
||||
import org.hibernate.type.CompositeType;
|
||||
import org.hibernate.type.Type;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
* @author Gail Badner
|
||||
*/
|
||||
public class CompositeFetchImpl extends AbstractCompositeFetch implements CompositeAttributeFetch {
|
||||
public class CompositeAttributeFetchImpl extends AbstractCompositeFetch implements CompositeAttributeFetch {
|
||||
private final FetchSource source;
|
||||
private final AttributeDefinition fetchedAttribute;
|
||||
|
||||
protected CompositeFetchImpl(
|
||||
protected CompositeAttributeFetchImpl(
|
||||
FetchSource source,
|
||||
AttributeDefinition attributeDefinition,
|
||||
ExpandingCompositeQuerySpace compositeQuerySpace,
|
||||
boolean allowCollectionFetches) {
|
||||
super(
|
||||
(CompositeType) attributeDefinition.getType(),
|
||||
compositeQuerySpace,
|
||||
allowCollectionFetches,
|
||||
source.getPropertyPath().append( attributeDefinition.getName() )
|
||||
|
@ -60,4 +61,19 @@ public class CompositeFetchImpl extends AbstractCompositeFetch implements Compos
|
|||
public AttributeDefinition getFetchedAttributeDefinition() {
|
||||
return fetchedAttribute;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type getFetchedType() {
|
||||
return fetchedAttribute.getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNullable() {
|
||||
return fetchedAttribute.isNullable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityReference resolveEntityReference() {
|
||||
return source.resolveEntityReference();
|
||||
}
|
||||
}
|
|
@ -26,7 +26,6 @@ package org.hibernate.loader.plan2.build.internal.returns;
|
|||
import org.hibernate.loader.PropertyPath;
|
||||
import org.hibernate.loader.plan2.build.spi.ExpandingCompositeQuerySpace;
|
||||
import org.hibernate.loader.plan2.build.spi.ExpandingEntityIdentifierDescription;
|
||||
import org.hibernate.loader.plan2.spi.CompositeQuerySpace;
|
||||
import org.hibernate.loader.plan2.spi.EntityReference;
|
||||
import org.hibernate.type.CompositeType;
|
||||
|
||||
|
@ -55,5 +54,4 @@ public class EncapsulatedEntityIdentifierDescription
|
|||
PropertyPath propertyPath) {
|
||||
super( entityReference, compositeQuerySpace, compositeType, propertyPath );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -36,12 +36,12 @@ import org.hibernate.type.EntityType;
|
|||
/**
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class EntityFetchImpl extends AbstractEntityReference implements EntityFetch {
|
||||
public class EntityAttributeFetchImpl extends AbstractEntityReference implements EntityFetch {
|
||||
private final FetchSource fetchSource;
|
||||
private final AttributeDefinition fetchedAttribute;
|
||||
private final FetchStrategy fetchStrategy;
|
||||
|
||||
public EntityFetchImpl(
|
||||
public EntityAttributeFetchImpl(
|
||||
ExpandingFetchSource fetchSource,
|
||||
AssociationAttributeDefinition fetchedAttribute,
|
||||
FetchStrategy fetchStrategy,
|
|
@ -27,7 +27,6 @@ import org.hibernate.engine.FetchStrategy;
|
|||
import org.hibernate.loader.PropertyPath;
|
||||
import org.hibernate.loader.plan2.build.spi.ExpandingFetchSource;
|
||||
import org.hibernate.loader.plan2.build.spi.ExpandingQuerySpaces;
|
||||
import org.hibernate.loader.plan2.build.spi.LoadPlanBuildingContext;
|
||||
import org.hibernate.loader.plan2.spi.EntityReturn;
|
||||
import org.hibernate.persister.walking.spi.AttributeDefinition;
|
||||
import org.hibernate.persister.walking.spi.EntityDefinition;
|
||||
|
|
|
@ -25,25 +25,25 @@ package org.hibernate.loader.plan2.build.internal.returns;
|
|||
|
||||
import org.hibernate.loader.plan2.build.spi.ExpandingCompositeQuerySpace;
|
||||
import org.hibernate.loader.plan2.spi.CompositeAttributeFetch;
|
||||
import org.hibernate.loader.plan2.spi.CompositeFetch;
|
||||
import org.hibernate.loader.plan2.spi.EntityReference;
|
||||
import org.hibernate.loader.plan2.spi.FetchSource;
|
||||
import org.hibernate.persister.walking.spi.AttributeDefinition;
|
||||
import org.hibernate.type.CompositeType;
|
||||
import org.hibernate.type.Type;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
* @author Gail Badner
|
||||
*/
|
||||
public class NestedCompositeFetchImpl extends AbstractCompositeFetch implements CompositeAttributeFetch {
|
||||
private final CompositeFetch source;
|
||||
public class NestedCompositeAttributeFetchImpl extends AbstractCompositeFetch implements CompositeAttributeFetch {
|
||||
private final FetchSource source;
|
||||
private final AttributeDefinition fetchedAttributeDefinition;
|
||||
|
||||
public NestedCompositeFetchImpl(
|
||||
CompositeFetch source,
|
||||
public NestedCompositeAttributeFetchImpl(
|
||||
FetchSource source,
|
||||
AttributeDefinition fetchedAttributeDefinition,
|
||||
ExpandingCompositeQuerySpace compositeQuerySpace,
|
||||
boolean allowCollectionFetches) {
|
||||
super(
|
||||
(CompositeType) fetchedAttributeDefinition.getType(),
|
||||
compositeQuerySpace,
|
||||
allowCollectionFetches,
|
||||
source.getPropertyPath().append( fetchedAttributeDefinition.getName() )
|
||||
|
@ -57,8 +57,23 @@ public class NestedCompositeFetchImpl extends AbstractCompositeFetch implements
|
|||
return source;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type getFetchedType() {
|
||||
return fetchedAttributeDefinition.getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNullable() {
|
||||
return fetchedAttributeDefinition.isNullable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AttributeDefinition getFetchedAttributeDefinition() {
|
||||
return fetchedAttributeDefinition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityReference resolveEntityReference() {
|
||||
return source.resolveEntityReference();
|
||||
}
|
||||
}
|
|
@ -23,10 +23,12 @@
|
|||
*/
|
||||
package org.hibernate.loader.plan2.build.internal.returns;
|
||||
|
||||
import org.hibernate.engine.FetchStrategy;
|
||||
import org.hibernate.loader.PropertyPath;
|
||||
import org.hibernate.loader.plan2.build.spi.ExpandingCompositeQuerySpace;
|
||||
import org.hibernate.loader.plan2.spi.EntityReference;
|
||||
import org.hibernate.type.CompositeType;
|
||||
import org.hibernate.type.Type;
|
||||
|
||||
/**
|
||||
* Models a composite entity identifier that is non-encapsulated (meaning there is no composite class, no
|
||||
|
|
|
@ -41,7 +41,7 @@ import org.hibernate.loader.plan2.build.internal.spaces.QuerySpacesImpl;
|
|||
import org.hibernate.loader.plan2.build.internal.returns.CollectionReturnImpl;
|
||||
import org.hibernate.loader.plan2.build.internal.returns.EntityReturnImpl;
|
||||
import org.hibernate.loader.plan2.spi.AttributeFetch;
|
||||
import org.hibernate.loader.plan2.spi.CollectionFetch;
|
||||
import org.hibernate.loader.plan2.spi.CollectionAttributeFetch;
|
||||
import org.hibernate.loader.plan2.spi.CollectionFetchableElement;
|
||||
import org.hibernate.loader.plan2.spi.CollectionFetchableIndex;
|
||||
import org.hibernate.loader.plan2.spi.CollectionReference;
|
||||
|
@ -467,10 +467,6 @@ public abstract class AbstractLoadPlanBuildingAssociationVisitationStrategy
|
|||
@Override
|
||||
public void startingCollectionElements(CollectionElementDefinition elementDefinition) {
|
||||
final Type elementType = elementDefinition.getType();
|
||||
if ( elementType.isAnyType() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
log.tracef(
|
||||
"%s Starting collection element graph : %s",
|
||||
StringHelper.repeat( ">>", fetchSourceStack.size() ),
|
||||
|
@ -487,8 +483,9 @@ public abstract class AbstractLoadPlanBuildingAssociationVisitationStrategy
|
|||
elementDefinition.getCollectionDefinition().getCollectionPersister().getRole()
|
||||
);
|
||||
}
|
||||
|
||||
pushToStack( (ExpandingFetchSource) elementGraph );
|
||||
if ( !elementType.isAnyType() ) {
|
||||
pushToStack( (ExpandingFetchSource) elementGraph );
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( elementGraph != null ) {
|
||||
|
@ -503,11 +500,11 @@ public abstract class AbstractLoadPlanBuildingAssociationVisitationStrategy
|
|||
@Override
|
||||
public void finishingCollectionElements(CollectionElementDefinition elementDefinition) {
|
||||
final Type elementType = elementDefinition.getType();
|
||||
if ( elementType.isAnyType() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( elementType.isComponentType() || elementType.isAssociationType()) {
|
||||
if ( elementType.isAnyType() ) {
|
||||
// nothing to do because the element graph was not pushed
|
||||
}
|
||||
else if ( elementType.isComponentType() || elementType.isAssociationType()) {
|
||||
// pop it from the stack
|
||||
final ExpandingFetchSource popped = popFromStack();
|
||||
|
||||
|
@ -862,7 +859,7 @@ public abstract class AbstractLoadPlanBuildingAssociationVisitationStrategy
|
|||
}
|
||||
|
||||
protected boolean handleCompositeAttribute(AttributeDefinition attributeDefinition) {
|
||||
final CompositeFetch compositeFetch = currentSource().buildCompositeFetch( attributeDefinition );
|
||||
final CompositeFetch compositeFetch = currentSource().buildCompositeAttributeFetch( attributeDefinition );
|
||||
pushToStack( (ExpandingFetchSource) compositeFetch );
|
||||
return true;
|
||||
}
|
||||
|
@ -879,14 +876,14 @@ public abstract class AbstractLoadPlanBuildingAssociationVisitationStrategy
|
|||
|
||||
final AssociationAttributeDefinition.AssociationNature nature = attributeDefinition.getAssociationNature();
|
||||
if ( nature == AssociationAttributeDefinition.AssociationNature.ANY ) {
|
||||
currentSource.buildAnyFetch(
|
||||
currentSource.buildAnyAttributeFetch(
|
||||
attributeDefinition,
|
||||
fetchStrategy
|
||||
);
|
||||
return false;
|
||||
}
|
||||
else if ( nature == AssociationAttributeDefinition.AssociationNature.ENTITY ) {
|
||||
EntityFetch fetch = currentSource.buildEntityFetch(
|
||||
EntityFetch fetch = currentSource.buildEntityAttributeFetch(
|
||||
attributeDefinition,
|
||||
fetchStrategy
|
||||
);
|
||||
|
@ -900,7 +897,7 @@ public abstract class AbstractLoadPlanBuildingAssociationVisitationStrategy
|
|||
}
|
||||
else {
|
||||
// Collection
|
||||
CollectionFetch fetch = currentSource.buildCollectionFetch( attributeDefinition, fetchStrategy );
|
||||
CollectionAttributeFetch fetch = currentSource.buildCollectionAttributeFetch( attributeDefinition, fetchStrategy );
|
||||
if ( fetchStrategy.getStyle() == FetchStyle.JOIN ) {
|
||||
pushToCollectionStack( fetch );
|
||||
return true;
|
||||
|
|
|
@ -24,10 +24,10 @@
|
|||
package org.hibernate.loader.plan2.build.spi;
|
||||
|
||||
import org.hibernate.engine.FetchStrategy;
|
||||
import org.hibernate.loader.plan2.spi.AnyFetch;
|
||||
import org.hibernate.loader.plan2.spi.AnyAttributeFetch;
|
||||
import org.hibernate.loader.plan2.spi.BidirectionalEntityReference;
|
||||
import org.hibernate.loader.plan2.spi.CollectionFetch;
|
||||
import org.hibernate.loader.plan2.spi.CompositeFetch;
|
||||
import org.hibernate.loader.plan2.spi.CollectionAttributeFetch;
|
||||
import org.hibernate.loader.plan2.spi.CompositeAttributeFetch;
|
||||
import org.hibernate.loader.plan2.spi.EntityFetch;
|
||||
import org.hibernate.loader.plan2.spi.EntityReference;
|
||||
import org.hibernate.loader.plan2.spi.FetchSource;
|
||||
|
@ -49,7 +49,7 @@ public interface ExpandingFetchSource extends FetchSource {
|
|||
*/
|
||||
public void validateFetchPlan(FetchStrategy fetchStrategy, AttributeDefinition attributeDefinition);
|
||||
|
||||
public EntityFetch buildEntityFetch(
|
||||
public EntityFetch buildEntityAttributeFetch(
|
||||
AssociationAttributeDefinition attributeDefinition,
|
||||
FetchStrategy fetchStrategy);
|
||||
|
||||
|
@ -58,14 +58,14 @@ public interface ExpandingFetchSource extends FetchSource {
|
|||
FetchStrategy fetchStrategy,
|
||||
EntityReference targetEntityReference);
|
||||
|
||||
public CompositeFetch buildCompositeFetch(
|
||||
public CompositeAttributeFetch buildCompositeAttributeFetch(
|
||||
AttributeDefinition attributeDefinition);
|
||||
|
||||
public CollectionFetch buildCollectionFetch(
|
||||
public CollectionAttributeFetch buildCollectionAttributeFetch(
|
||||
AssociationAttributeDefinition attributeDefinition,
|
||||
FetchStrategy fetchStrategy);
|
||||
|
||||
public AnyFetch buildAnyFetch(
|
||||
public AnyAttributeFetch buildAnyAttributeFetch(
|
||||
AssociationAttributeDefinition attributeDefinition,
|
||||
FetchStrategy fetchStrategy);
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ import java.io.PrintStream;
|
|||
import java.io.PrintWriter;
|
||||
|
||||
import org.hibernate.loader.plan2.spi.BidirectionalEntityReference;
|
||||
import org.hibernate.loader.plan2.spi.CollectionFetch;
|
||||
import org.hibernate.loader.plan2.spi.CollectionAttributeFetch;
|
||||
import org.hibernate.loader.plan2.spi.CollectionFetchableElement;
|
||||
import org.hibernate.loader.plan2.spi.CollectionFetchableIndex;
|
||||
import org.hibernate.loader.plan2.spi.CollectionReference;
|
||||
|
@ -183,8 +183,8 @@ public class ReturnGraphTreePrinter {
|
|||
printWriter.println( extractDetails( compositeFetch ) );
|
||||
writeCompositeFetchFetches( compositeFetch, depth+1, printWriter );
|
||||
}
|
||||
else if ( CollectionFetch.class.isInstance( fetch ) ) {
|
||||
final CollectionFetch collectionFetch = (CollectionFetch) fetch;
|
||||
else if ( CollectionAttributeFetch.class.isInstance( fetch ) ) {
|
||||
final CollectionAttributeFetch collectionFetch = (CollectionAttributeFetch) fetch;
|
||||
printWriter.println( extractDetails( collectionFetch ) );
|
||||
writeCollectionReferenceFetches( collectionFetch, depth+1, printWriter );
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ import org.hibernate.loader.plan2.exec.query.spi.QueryBuildingParameters;
|
|||
import org.hibernate.loader.plan2.exec.spi.AliasResolutionContext;
|
||||
import org.hibernate.loader.plan2.exec.spi.CollectionReferenceAliases;
|
||||
import org.hibernate.loader.plan2.exec.spi.EntityReferenceAliases;
|
||||
import org.hibernate.loader.plan2.spi.CollectionFetch;
|
||||
import org.hibernate.loader.plan2.spi.CollectionAttributeFetch;
|
||||
import org.hibernate.loader.plan2.spi.CollectionQuerySpace;
|
||||
import org.hibernate.loader.plan2.spi.CompositeQuerySpace;
|
||||
import org.hibernate.loader.plan2.spi.EntityFetch;
|
||||
|
@ -439,8 +439,8 @@ public class LoadQueryJoinAndFetchProcessor {
|
|||
fetchStats
|
||||
);
|
||||
}
|
||||
else if ( CollectionFetch.class.isInstance( fetch ) ) {
|
||||
final CollectionFetch collectionFetch = (CollectionFetch) fetch;
|
||||
else if ( CollectionAttributeFetch.class.isInstance( fetch ) ) {
|
||||
final CollectionAttributeFetch collectionFetch = (CollectionAttributeFetch) fetch;
|
||||
processCollectionFetch(
|
||||
selectStatementBuilder,
|
||||
fetchSource,
|
||||
|
@ -519,7 +519,7 @@ public class LoadQueryJoinAndFetchProcessor {
|
|||
private void processCollectionFetch(
|
||||
SelectStatementBuilder selectStatementBuilder,
|
||||
FetchSource fetchSource,
|
||||
CollectionFetch fetch,
|
||||
CollectionAttributeFetch fetch,
|
||||
ReaderCollector readerCollector,
|
||||
FetchStatsImpl fetchStats) {
|
||||
fetchStats.processingFetch( fetch );
|
||||
|
|
|
@ -26,5 +26,5 @@ package org.hibernate.loader.plan2.spi;
|
|||
/**
|
||||
* @author Gail Badner
|
||||
*/
|
||||
public interface AnyFetch extends AttributeFetch, FetchSource {
|
||||
public interface AnyAttributeFetch extends Fetch, FetchSource {
|
||||
}
|
|
@ -30,7 +30,7 @@ import org.hibernate.type.CollectionType;
|
|||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public interface CollectionFetch extends AttributeFetch, CollectionReference {
|
||||
public interface CollectionAttributeFetch extends AttributeFetch, CollectionReference {
|
||||
@Override
|
||||
public CollectionType getFetchedType();
|
||||
|
|
@ -27,6 +27,7 @@ import org.hibernate.cfg.Configuration;
|
|||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
|
||||
import org.hibernate.loader.plan2.spi.BidirectionalEntityReference;
|
||||
import org.hibernate.loader.plan2.spi.CollectionAttributeFetch;
|
||||
import org.hibernate.test.annotations.Country;
|
||||
import org.hibernate.test.annotations.collectionelement.Boy;
|
||||
import org.hibernate.test.annotations.collectionelement.Matrix;
|
||||
|
@ -35,7 +36,6 @@ import org.hibernate.test.loadplans.process.EncapsulatedCompositeIdResultSetProc
|
|||
|
||||
//import org.hibernate.loader.plan2.spi.BidirectionalEntityFetch;
|
||||
import org.hibernate.loader.plan2.build.internal.returns.CollectionFetchableElementEntityGraph;
|
||||
import org.hibernate.loader.plan2.spi.CollectionFetch;
|
||||
import org.hibernate.loader.plan2.spi.EntityFetch;
|
||||
import org.hibernate.loader.plan2.spi.EntityReturn;
|
||||
import org.hibernate.loader.plan2.spi.FetchSource;
|
||||
|
@ -213,7 +213,7 @@ public class LoadPlanStructureAssertionTest extends BaseUnitTestCase {
|
|||
|
||||
// Card should have one fetch, the fields collection
|
||||
assertEquals( 1, cardReturn.getFetches().length );
|
||||
final CollectionFetch fieldsFetch = assertTyping( CollectionFetch.class, cardReturn.getFetches()[0] );
|
||||
final CollectionAttributeFetch fieldsFetch = assertTyping( CollectionAttributeFetch.class, cardReturn.getFetches()[0] );
|
||||
assertNotNull( fieldsFetch.getElementGraph() );
|
||||
|
||||
// the Card.fields collection has entity elements of type CardField...
|
||||
|
|
Loading…
Reference in New Issue