Top Description Fields Constructors Methods
org.hibernate.persister.walking.spi

public Class MetamodelGraphWalker

extends Object
Class Inheritance
Imports
java.util.HashSet, .Set, org.hibernate.engine.spi.SessionFactoryImplementor, org.hibernate.loader.PropertyPath, org.hibernate.persister.collection.CollectionPersister, .QueryableCollection, org.hibernate.persister.entity.AbstractEntityPersister, .EntityPersister, org.hibernate.type.Type, org.jboss.logging.Logger

Implements metamodel graph walking. In layman terms, we are walking the graph of the users domain model as defined/understood by mapped associations.

Initially grew as a part of the re-implementation of the legacy JoinWalker functionality to instead build LoadPlans. But this is really quite simple walking. Interesting events are handled by calling out to implementations of AssociationVisitationStrategy which really provide the real functionality of what we do as we walk.

The visitor will walk the entire metamodel graph (the parts reachable from the given root)!!! It is up to the provided AssociationVisitationStrategy to tell it when to stop. The walker provides the walking; the strategy provides the semantics of what happens at certain points. Its really very similar to parsers and how parsing is generally split between syntax and semantics. Walker walks the syntax (associations, identifiers, etc) and when it calls out to the strategy the strategy then decides the semantics (literally, the meaning).

The visitor will, however, stop if it sees a "duplicate" AssociationKey. In such a case, the walker would call AssociationVisitationStrategy#foundCircularAssociation and stop walking any further down that graph any further.

Author
Steve Ebersole

Field Summary

Modifier and TypeField and Description
private PropertyPath
private final SessionFactoryImplementor
factory

Deprecated as a consequence of SessionFactoryImplementor being deprecated.
private static final Logger
private final AssociationVisitationStrategy
private final Set<AssociationKey>

Constructor Summary

AccessConstructor and Description
public
MetamodelGraphWalker(AssociationVisitationStrategy strategy, SessionFactoryImplementor factory)

Deprecated as a consequence of SessionFactoryImplementor being deprecated.

Method Summary

Modifier and TypeMethod and Description
protected void
addAssociationKey(AssociationKey
- the association key.
associationKey
)

Add association key to indicate the association is being visited.

protected boolean

Returns:

true, if the association with the specified association key has already been visited; false, otherwise.
isDuplicateAssociationKey
(AssociationKey
- the association key.
associationKey
)

Has an association with the specified key been visited already?

private void
private void
private void
private void
visitAttributes(AttributeSource attributeSource, AbstractEntityPersister sourcePersister)

public static void
visitCollection(AssociationVisitationStrategy
The semantics strategy
strategy
,
CollectionPersister
The persister describing the collection to start walking from
persister
)

Entry point into walking the model graph of a collection according to its defined metamodel.

private void
private void
private void
private void
public static void
visitEntity(AssociationVisitationStrategy
The semantics strategy
strategy
,
EntityPersister
The persister describing the entity to start walking from
persister
)

Entry point into walking the model graph of an entity according to its defined metamodel.

private void
private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

currentPropertyPathback to summary
private PropertyPath currentPropertyPath
factoryback to summary
private final SessionFactoryImplementor factory

Deprecated

as a consequence of SessionFactoryImplementor being deprecated. See corresponding docs for further information.

logback to summary
private static final Logger log
strategyback to summary
private final AssociationVisitationStrategy strategy
visitedAssociationKeysback to summary
private final Set<AssociationKey> visitedAssociationKeys

Constructor Detail

MetamodelGraphWalkerback to summary
public MetamodelGraphWalker(AssociationVisitationStrategy strategy, SessionFactoryImplementor factory)

Deprecated

as a consequence of SessionFactoryImplementor being deprecated. See corresponding docs for further information.

Method Detail

addAssociationKeyback to summary
protected void addAssociationKey(AssociationKey associationKey)

Add association key to indicate the association is being visited.

Parameters
associationKey:AssociationKey

- the association key.

Exceptions
WalkingException:
if the association with the specified association key has already been visited.
isDuplicateAssociationKeyback to summary
protected boolean isDuplicateAssociationKey(AssociationKey associationKey)

Has an association with the specified key been visited already?

Parameters
associationKey:AssociationKey

- the association key.

Returns:boolean

true, if the association with the specified association key has already been visited; false, otherwise.

visitAnyDefinitionback to summary
private void visitAnyDefinition(AnyMappingDefinition anyDefinition)
visitAssociationback to summary
private void visitAssociation(AssociationAttributeDefinition attribute)
visitAttributeDefinitionback to summary
private void visitAttributeDefinition(AttributeDefinition attributeDefinition, AbstractEntityPersister sourcePersister)
visitAttributesback to summary
private void visitAttributes(AttributeSource attributeSource, AbstractEntityPersister sourcePersister)
visitCollectionback to summary
public static void visitCollection(AssociationVisitationStrategy strategy, CollectionPersister persister)

Entry point into walking the model graph of a collection according to its defined metamodel.

Parameters
strategy:AssociationVisitationStrategy

The semantics strategy

persister:CollectionPersister

The persister describing the collection to start walking from

visitCollectionDefinitionback to summary
private void visitCollectionDefinition(CollectionDefinition collectionDefinition)
visitCollectionElementsback to summary
private void visitCollectionElements(CollectionDefinition collectionDefinition)
visitCollectionIndexback to summary
private void visitCollectionIndex(CollectionDefinition collectionDefinition)
visitCompositeDefinitionback to summary
private void visitCompositeDefinition(CompositionDefinition compositionDefinition)
visitEntityback to summary
public static void visitEntity(AssociationVisitationStrategy strategy, EntityPersister persister)

Entry point into walking the model graph of an entity according to its defined metamodel.

Parameters
strategy:AssociationVisitationStrategy

The semantics strategy

persister:EntityPersister

The persister describing the entity to start walking from

visitEntityDefinitionback to summary
private void visitEntityDefinition(EntityDefinition entityDefinition)
visitIdentifierDefinitionback to summary
private void visitIdentifierDefinition(EntityIdentifierDefinition identifierDefinition)