HHH-8750 : Move load plan implementations from spi to internal
This commit is contained in:
parent
ebedc75e0f
commit
a2c543e088
|
@ -90,12 +90,7 @@ public class AliasResolutionContextImpl implements AliasResolutionContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a AliasResolutionContextImpl without any source aliases. This form is used in
|
* Constructs a AliasResolutionContextImpl with the specified seed for unique alias suffixes.
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
* @param sessionFactory The session factory
|
* @param sessionFactory The session factory
|
||||||
* @param suffixSeed The seed value to use for generating the suffix used when generating SQL aliases.
|
* @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()
|
* @see org.hibernate.loader.plan.spi.EntityReference#getEntityPersister()
|
||||||
*/
|
*/
|
||||||
public EntityReferenceAliases generateEntityReferenceAliases(String uid, EntityPersister entityPersister) {
|
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(
|
final EntityReferenceAliasesImpl entityReferenceAliases = new EntityReferenceAliasesImpl(
|
||||||
createTableAlias( entityPersister ),
|
tableAlias,
|
||||||
createEntityAliases( entityPersister )
|
createEntityAliases( entityPersister )
|
||||||
);
|
);
|
||||||
registerQuerySpaceAliases( uid, entityReferenceAliases );
|
registerQuerySpaceAliases( uid, entityReferenceAliases );
|
||||||
|
@ -211,13 +213,10 @@ public class AliasResolutionContextImpl implements AliasResolutionContext {
|
||||||
tableAlias,
|
tableAlias,
|
||||||
manyToManyTableAlias,
|
manyToManyTableAlias,
|
||||||
createCollectionAliases( persister ),
|
createCollectionAliases( persister ),
|
||||||
createCollectionElementAliases( persister )
|
createCollectionElementAliases( persister, tableAlias, elementQuerySpaceUid )
|
||||||
);
|
);
|
||||||
|
|
||||||
registerQuerySpaceAliases( collectionQuerySpaceUid, collectionAliases );
|
registerQuerySpaceAliases( collectionQuerySpaceUid, collectionAliases );
|
||||||
if ( collectionAliases.getEntityElementAliases() != null ) {
|
|
||||||
registerQuerySpaceAliases( elementQuerySpaceUid, collectionAliases.getEntityElementAliases() );
|
|
||||||
}
|
|
||||||
return collectionAliases;
|
return collectionAliases;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,13 +224,20 @@ public class AliasResolutionContextImpl implements AliasResolutionContext {
|
||||||
return new GeneratedCollectionAliases( collectionPersister, createSuffix() );
|
return new GeneratedCollectionAliases( collectionPersister, createSuffix() );
|
||||||
}
|
}
|
||||||
|
|
||||||
private EntityAliases createCollectionElementAliases(CollectionPersister collectionPersister) {
|
private EntityReferenceAliases createCollectionElementAliases(
|
||||||
|
CollectionPersister collectionPersister,
|
||||||
|
String tableAlias,
|
||||||
|
String elementQuerySpaceUid) {
|
||||||
if ( !collectionPersister.getElementType().isEntityType() ) {
|
if ( !collectionPersister.getElementType().isEntityType() ) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
final EntityType entityElementType = (EntityType) collectionPersister.getElementType();
|
final EntityType entityElementType = (EntityType) collectionPersister.getElementType();
|
||||||
return createEntityAliases( (EntityPersister) entityElementType.getAssociatedJoinable( sessionFactory() ) );
|
return generateEntityReferenceAliases(
|
||||||
|
elementQuerySpaceUid,
|
||||||
|
tableAlias,
|
||||||
|
(EntityPersister) entityElementType.getAssociatedJoinable( sessionFactory() )
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,12 +25,12 @@ package org.hibernate.loader.plan.exec.internal;
|
||||||
|
|
||||||
import org.hibernate.internal.util.StringHelper;
|
import org.hibernate.internal.util.StringHelper;
|
||||||
import org.hibernate.loader.CollectionAliases;
|
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.CollectionReferenceAliases;
|
||||||
import org.hibernate.loader.plan.exec.spi.EntityReferenceAliases;
|
import org.hibernate.loader.plan.exec.spi.EntityReferenceAliases;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
|
* @author Gail Badner
|
||||||
*/
|
*/
|
||||||
public class CollectionReferenceAliasesImpl implements CollectionReferenceAliases {
|
public class CollectionReferenceAliasesImpl implements CollectionReferenceAliases {
|
||||||
private final String tableAlias;
|
private final String tableAlias;
|
||||||
|
@ -42,13 +42,11 @@ public class CollectionReferenceAliasesImpl implements CollectionReferenceAliase
|
||||||
String tableAlias,
|
String tableAlias,
|
||||||
String manyToManyAssociationTableAlias,
|
String manyToManyAssociationTableAlias,
|
||||||
CollectionAliases collectionAliases,
|
CollectionAliases collectionAliases,
|
||||||
EntityAliases entityElementAliases) {
|
EntityReferenceAliases entityElementAliases) {
|
||||||
this.tableAlias = tableAlias;
|
this.tableAlias = tableAlias;
|
||||||
this.manyToManyAssociationTableAlias = manyToManyAssociationTableAlias;
|
this.manyToManyAssociationTableAlias = manyToManyAssociationTableAlias;
|
||||||
this.collectionAliases = collectionAliases;
|
this.collectionAliases = collectionAliases;
|
||||||
this.entityElementAliases = entityElementAliases == null ?
|
this.entityElementAliases = entityElementAliases;
|
||||||
null :
|
|
||||||
new EntityReferenceAliasesImpl( tableAlias, entityElementAliases );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue