HHH-8750 : Move load plan implementations from spi to internal

This commit is contained in:
Gail Badner 2013-11-27 15:35:34 -08:00
parent ebedc75e0f
commit a2c543e088
2 changed files with 22 additions and 18 deletions

View File

@ -90,12 +90,7 @@ public class AliasResolutionContextImpl implements AliasResolutionContext {
}
/**
* Constructs a AliasResolutionContextImpl without any source aliases. This form is used in
* non-query contexts. Example of query contexts are: HQL, criteria, etc.
* <p/>
* See the notes on
* {@link org.hibernate.loader.plan.exec.spi.AliasResolutionContext#getSourceAlias} for discussion of
* "source aliases". They are not implemented here yet.
* Constructs a AliasResolutionContextImpl with the specified seed for unique alias suffixes.
*
* @param sessionFactory The session factory
* @param suffixSeed The seed value to use for generating the suffix used when generating SQL aliases.
@ -134,8 +129,15 @@ public class AliasResolutionContextImpl implements AliasResolutionContext {
* @see org.hibernate.loader.plan.spi.EntityReference#getEntityPersister()
*/
public EntityReferenceAliases generateEntityReferenceAliases(String uid, EntityPersister entityPersister) {
return generateEntityReferenceAliases( uid, createTableAlias( entityPersister ), entityPersister );
}
private EntityReferenceAliases generateEntityReferenceAliases(
String uid,
String tableAlias,
EntityPersister entityPersister) {
final EntityReferenceAliasesImpl entityReferenceAliases = new EntityReferenceAliasesImpl(
createTableAlias( entityPersister ),
tableAlias,
createEntityAliases( entityPersister )
);
registerQuerySpaceAliases( uid, entityReferenceAliases );
@ -211,13 +213,10 @@ public class AliasResolutionContextImpl implements AliasResolutionContext {
tableAlias,
manyToManyTableAlias,
createCollectionAliases( persister ),
createCollectionElementAliases( persister )
createCollectionElementAliases( persister, tableAlias, elementQuerySpaceUid )
);
registerQuerySpaceAliases( collectionQuerySpaceUid, collectionAliases );
if ( collectionAliases.getEntityElementAliases() != null ) {
registerQuerySpaceAliases( elementQuerySpaceUid, collectionAliases.getEntityElementAliases() );
}
return collectionAliases;
}
@ -225,13 +224,20 @@ public class AliasResolutionContextImpl implements AliasResolutionContext {
return new GeneratedCollectionAliases( collectionPersister, createSuffix() );
}
private EntityAliases createCollectionElementAliases(CollectionPersister collectionPersister) {
private EntityReferenceAliases createCollectionElementAliases(
CollectionPersister collectionPersister,
String tableAlias,
String elementQuerySpaceUid) {
if ( !collectionPersister.getElementType().isEntityType() ) {
return null;
}
else {
final EntityType entityElementType = (EntityType) collectionPersister.getElementType();
return createEntityAliases( (EntityPersister) entityElementType.getAssociatedJoinable( sessionFactory() ) );
return generateEntityReferenceAliases(
elementQuerySpaceUid,
tableAlias,
(EntityPersister) entityElementType.getAssociatedJoinable( sessionFactory() )
);
}
}

View File

@ -25,12 +25,12 @@ package org.hibernate.loader.plan.exec.internal;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.loader.CollectionAliases;
import org.hibernate.loader.EntityAliases;
import org.hibernate.loader.plan.exec.spi.CollectionReferenceAliases;
import org.hibernate.loader.plan.exec.spi.EntityReferenceAliases;
/**
* @author Steve Ebersole
* @author Gail Badner
*/
public class CollectionReferenceAliasesImpl implements CollectionReferenceAliases {
private final String tableAlias;
@ -42,13 +42,11 @@ public class CollectionReferenceAliasesImpl implements CollectionReferenceAliase
String tableAlias,
String manyToManyAssociationTableAlias,
CollectionAliases collectionAliases,
EntityAliases entityElementAliases) {
EntityReferenceAliases entityElementAliases) {
this.tableAlias = tableAlias;
this.manyToManyAssociationTableAlias = manyToManyAssociationTableAlias;
this.collectionAliases = collectionAliases;
this.entityElementAliases = entityElementAliases == null ?
null :
new EntityReferenceAliasesImpl( tableAlias, entityElementAliases );
this.entityElementAliases = entityElementAliases;
}
@Override