HHH-7841 - Redesign Loader

This commit is contained in:
Gail Badner 2013-04-22 15:50:35 -07:00
parent 63093dbfd9
commit 8c7dfc9d28
2 changed files with 18 additions and 8 deletions

View File

@ -113,7 +113,15 @@ public class MetadataDrivenModelGraphVisitor {
final PropertyPath subPath = currentPropertyPath.append( attributeDefinition.getName() );
log.debug( "Visiting attribute path : " + subPath.getFullPath() );
final boolean continueWalk = strategy.startingAttribute( attributeDefinition );
final boolean continueWalk;
if ( attributeDefinition.getType().isAssociationType() ) {
continueWalk =
! isDuplicateAssociation( ( (AssociationAttributeDefinition) attributeDefinition ).getAssociationKey() ) &&
strategy.startingAttribute( attributeDefinition );
}
else {
continueWalk = strategy.startingAttribute( attributeDefinition );
}
if ( continueWalk ) {
final PropertyPath old = currentPropertyPath;
currentPropertyPath = subPath;
@ -135,11 +143,6 @@ public class MetadataDrivenModelGraphVisitor {
private void visitAssociation(AssociationAttributeDefinition attribute) {
// todo : do "too deep" checks; but see note about adding depth to PropertyPath
if ( isDuplicateAssociation( attribute.getAssociationKey() ) ) {
log.debug( "Property path deemed to be circular : " + currentPropertyPath.getFullPath() );
return;
}
if ( attribute.isCollection() ) {
visitCollectionDefinition( attribute.toCollectionDefinition() );
}
@ -210,7 +213,14 @@ public class MetadataDrivenModelGraphVisitor {
private final Set<AssociationKey> visitedAssociationKeys = new HashSet<AssociationKey>();
protected boolean isDuplicateAssociation(AssociationKey associationKey) {
return !visitedAssociationKeys.add( associationKey );
boolean isDuplicate = !visitedAssociationKeys.add( associationKey );
if ( isDuplicate ) {
log.debug( "Property path deemed to be circular : " + currentPropertyPath.getFullPath() );
return true;
}
else {
return false;
}
}
}

View File

@ -93,7 +93,7 @@ public class EntityBasedAssociationAttribute
lhsColumnNames = collectionPersister.getElementColumnNames();
}
else {
final OuterJoinLoadable entityPersister = (OuterJoinLoadable) joinable;
final OuterJoinLoadable entityPersister = (OuterJoinLoadable) source();
lhsTableName = getLHSTableName( type, attributeNumber(), entityPersister );
lhsColumnNames = getLHSColumnNames( type, attributeNumber(), entityPersister, sessionFactory() );
}