Class ToManyHolder<E>
java.lang.Object
org.apache.cayenne.access.ToManyHolder<E>
- Direct Known Subclasses:
ToManyList, ToManySet
An abstract superclass of lazily faulted to-many relationship collections. Tracks additions and removals made
while the relationship is still unresolved, and merges them into the fetched result on resolution.
- Since:
- 5.0
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotectedToManyHolder(Persistent relationshipOwner, String relationshipName) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidRecords an addition made while the relationship is unresolved.abstract voidTurns this collection into a fault, thus forcing a refresh on the next access.abstract booleanisFault()Returns whether this collection is not yet resolved and requires a fetch.protected booleanprotected booleanprotected voidmergeLocalChanges(List<E> fetched) Applies additions and removals recorded while unresolved to a freshly fetched list, then discards them.protected voidremoveLocal(E object) Records a removal made while the relationship is unresolved.Resolves related objects via the DataChannel stack of the owner's context, merging in any local changes made while the relationship was unresolved.abstract voidresolveWith(Collection<E> objects) Resolves this collection with the given objects without fetching them from the database.
-
Field Details
-
relationshipOwner
-
relationshipName
-
addedToUnresolved
-
removedFromUnresolved
-
-
Constructor Details
-
ToManyHolder
protected ToManyHolder() -
ToManyHolder
-
-
Method Details
-
isFault
public abstract boolean isFault()Returns whether this collection is not yet resolved and requires a fetch. -
invalidate
public abstract void invalidate()Turns this collection into a fault, thus forcing a refresh on the next access. -
resolveWith
Resolves this collection with the given objects without fetching them from the database. Used to inject prefetched results. -
isTransientParent
protected boolean isTransientParent() -
isUncommittedParent
protected boolean isUncommittedParent() -
resolveRelationship
-
addLocal
Records an addition made while the relationship is unresolved. -
removeLocal
Records a removal made while the relationship is unresolved. -
mergeLocalChanges
-