| Modifier and Type | Class and Description |
|---|---|
| private static class | NaturalIdResolutionsImpl.EntityResolutions
Represents the entity-specific cross-reference cache. |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private static final Logger | |
| private final StatefulPersistenceContext | |
| private final ConcurrentHashMap |
| Access | Constructor and Description |
|---|---|
| public | NaturalIdResolutionsImpl(StatefulPersistenceContext
The persistence context that owns this delegate persistenceContext)Constructs a NaturalIdXrefDelegate |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | cacheResolution(Object id, Object naturalId, EntityMappingType entityDescriptor)
Implements org. |
| public void | cacheResolutionFromLoad(Object id, Object naturalId, EntityMappingType entityDescriptor)
Implements org. |
| private boolean | cacheResolutionLocally(Object id, Object naturalId, EntityMappingType entityDescriptor)
Private, but see |
| public void | cleanupFromSynchronizations()
Implements org. handleSynchronization.
|
| public void | |
| public Object | findCachedIdByNaturalId(Object naturalId, EntityMappingType entityDescriptor)
Implements org. |
| public Object | findCachedNaturalIdById(Object id, EntityMappingType entityDescriptor)
Implements org. |
| public Collection | getCachedPkResolutions(EntityMappingType entityDescriptor)
Implements org. |
| public void | handleEviction(Object id, Object object, EntityMappingType entityDescriptor)
Implements org. org. to give a chance to clean up natural-id cross refs.
|
| public void | handleSynchronization(Object pk, Object entity, EntityMappingType entityDescriptor)
Implements org. |
| private boolean | |
| protected EntityPersister | Returns: The root persister.The persister representing the entity type. persister)It is only valid to define natural ids at the root of an entity hierarchy. |
| public void | manageLocalResolution(Object id, Object naturalIdValue, EntityMappingType entityDescriptor, CachedNaturalIdValueSource source)
Implements org. |
| public void | manageSharedResolution(final Object id, Object naturalId, Object previousNaturalId, EntityMappingType entityDescriptor, CachedNaturalIdValueSource source)
Implements org. |
| private void | manageSharedResolution(EntityPersister persister, final Object id, Object naturalIdValues, Object previousNaturalIdValues, CachedNaturalIdValueSource source)
|
| public Object | removeLocalResolution(Object id, Object naturalId, EntityMappingType entityDescriptor)
Implements org. |
| private Object | removeNaturalIdCrossReference(Object id, Object naturalIdValue, EntityPersister persister)
Removes the cross-reference from both Session cache (Resolution) as well as the second-level cache (NaturalIdDataAccess). |
| public Object | removeResolution(Object id, Object naturalId, EntityMappingType entityDescriptor)
Implements org. |
| public void | removeSharedResolution(Object id, Object naturalId, EntityMappingType entityDescriptor)
Implements org. |
| public boolean | Returns: true if the given naturalIdValues match the current cached values; false otherwise.The persister representing the entity type. persister, Object The primary key value pk, Object The natural id value(s) to check naturalIdValues)Are the naturals id values cached here (if any) for the given persister+pk combo the same as the given values? |
| protected SharedSessionContractImplementor | Returns: The sessionAccess to the session (via the PersistenceContext) to which this delegate ultimately belongs. |
| public void | stashInvalidNaturalIdReference(EntityPersister
The persister representing the entity type. persister, Object The "old" natural id values. invalidNaturalIdValues)As part of "load synchronization process", if a particular natural id is found to have changed we need to track its invalidity until after the next flush. |
| public void | unStashInvalidNaturalIdReferences()
Again, as part of "load synchronization process" we need to also be able to clear references to these known-invalid natural-ids after flush. |
| protected void | validateNaturalId(EntityMappingType
The entity type descriptor entityDescriptor, Object The natural id values naturalIdValues)Invariant validate of the natural id. Checks include
|
| LOG | back to summary |
|---|---|
| private static final Logger LOG | |
| persistenceContext | back to summary |
|---|---|
| private final StatefulPersistenceContext persistenceContext | |
| resolutionsByEntity | back to summary |
|---|---|
| private final ConcurrentHashMap<EntityMappingType, NaturalIdResolutionsImpl. | |
| NaturalIdResolutionsImpl | back to summary |
|---|---|
| public NaturalIdResolutionsImpl(StatefulPersistenceContext persistenceContext) Constructs a NaturalIdXrefDelegate
| |
| cacheResolution | back to summary |
|---|---|
| public boolean cacheResolution(Object id, Object naturalId, EntityMappingType entityDescriptor) Implements org. Doc from org. Caches a natural-id-to-identifier resolution. Handles both the local (transactional) and shared (second-level) caches.
| |
| cacheResolutionFromLoad | back to summary |
|---|---|
| public void cacheResolutionFromLoad(Object id, Object naturalId, EntityMappingType entityDescriptor) Implements org.
| |
| cacheResolutionLocally | back to summary |
|---|---|
| private boolean cacheResolutionLocally(Object id, Object naturalId, EntityMappingType entityDescriptor) Private, but see | |
| cleanupFromSynchronizations | back to summary |
|---|---|
| public void cleanupFromSynchronizations() Implements org. Doc from org. The clean up process of
| |
| clear | back to summary |
|---|---|
| public void clear() Clear the resolution cache | |
| findCachedIdByNaturalId | back to summary |
|---|---|
| public Object findCachedIdByNaturalId(Object naturalId, EntityMappingType entityDescriptor) Implements org. Doc from org. Find the cached identifier for the given natural-id
| |
| findCachedNaturalIdById | back to summary |
|---|---|
| public Object findCachedNaturalIdById(Object id, EntityMappingType entityDescriptor) Implements org. Doc from org. Find the cached natural-id for the given identifier | |
| getCachedPkResolutions | back to summary |
|---|---|
| public Collection Implements org. Doc from org. Find all the locally cached primary key cross-reference entries for the given entity.
| |
| handleEviction | back to summary |
|---|---|
| public void handleEviction(Object id, Object object, EntityMappingType entityDescriptor) Implements org. Doc from org. Called on
| |
| handleSynchronization | back to summary |
|---|---|
| public void handleSynchronization(Object pk, Object entity, EntityMappingType entityDescriptor) Implements org. Doc from org. Part of the "load synchronization process". Responsible for maintaining cross-reference entries when natural-id values were found to have changed.
Also responsible for tracking the old values as no longer valid until the next flush
because otherwise going to the database would just re-pull the old values as valid.
In this responsibility,
| |
| isValidValue | back to summary |
|---|---|
| private boolean isValidValue(Object naturalIdValues, EntityMappingType entityDescriptor) | |
| locatePersisterForKey | back to summary |
|---|---|
| protected EntityPersister locatePersisterForKey(EntityPersister persister) It is only valid to define natural ids at the root of an entity hierarchy. This method makes sure we are using the root persister.
| |
| manageLocalResolution | back to summary |
|---|---|
| public void manageLocalResolution(Object id, Object naturalIdValue, EntityMappingType entityDescriptor, CachedNaturalIdValueSource source) Implements org. Doc from org. Ensures that the necessary local cross-reference exists. Specifically, this only effects the persistence-context cache, not the L2 cache
| |
| manageSharedResolution | back to summary |
|---|---|
| public void manageSharedResolution(final Object id, Object naturalId, Object previousNaturalId, EntityMappingType entityDescriptor, CachedNaturalIdValueSource source) Implements org. Doc from org. Ensures that the necessary cross-reference exists in the L2 cache
| |
| manageSharedResolution | back to summary |
|---|---|
| private void manageSharedResolution(EntityPersister persister, final Object id, Object naturalIdValues, Object previousNaturalIdValues, CachedNaturalIdValueSource source) | |
| removeLocalResolution | back to summary |
|---|---|
| public Object removeLocalResolution(Object id, Object naturalId, EntityMappingType entityDescriptor) Implements org. Doc from org. Removes any local cross-reference, returning the previously cached value if one. Again, this only effects the persistence-context cache, not the L2 cache
| |
| removeNaturalIdCrossReference | back to summary |
|---|---|
| private Object removeNaturalIdCrossReference(Object id, Object naturalIdValue, EntityPersister persister) Removes the cross-reference from both Session cache (Resolution) as well as the second-level cache (NaturalIdDataAccess). Returns the natural-id value previously cached on the Session | |
| removeResolution | back to summary |
|---|---|
| public Object removeResolution(Object id, Object naturalId, EntityMappingType entityDescriptor) Implements org. Doc from org. Removes a natural-id-to-identifier resolution. Handles both the local (transactional) and shared (second-level) caches. | |
| removeSharedResolution | back to summary |
|---|---|
| public void removeSharedResolution(Object id, Object naturalId, EntityMappingType entityDescriptor) Implements org. Doc from org. Removes any cross-reference from the L2 cache
| |
| sameAsCached | back to summary |
|---|---|
| public boolean sameAsCached(EntityPersister persister, Object pk, Object naturalIdValues) Are the naturals id values cached here (if any) for the given persister+pk combo the same as the given values?
| |
| session | back to summary |
|---|---|
| protected SharedSessionContractImplementor session() Access to the session (via the PersistenceContext) to which this delegate ultimately belongs.
| |
| stashInvalidNaturalIdReference | back to summary |
|---|---|
| public void stashInvalidNaturalIdReference(EntityPersister persister, Object invalidNaturalIdValues) As part of "load synchronization process", if a particular natural id is found to have changed we need to track its invalidity until after the next flush. This method lets the "load synchronization process" indicate when it has encountered such changes.
| |
| unStashInvalidNaturalIdReferences | back to summary |
|---|---|
| public void unStashInvalidNaturalIdReferences() Again, as part of "load synchronization process" we need to also be able to clear references to these known-invalid natural-ids after flush. This method exposes that capability. | |
| validateNaturalId | back to summary |
|---|---|
| protected void validateNaturalId(EntityMappingType entityDescriptor, Object naturalIdValues) Invariant validate of the natural id. Checks include
| |
| Modifier and Type | Field and Description |
|---|---|
| private final EntityMappingType | |
| private List | |
| private final Map | |
| private final PersistenceContext | |
| private final Map |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | |
| public boolean | |
| public EntityMappingType | |
| public EntityPersister | |
| public boolean | |
| public void | |
| public void |
| entityDescriptor | back to summary |
|---|---|
| private final EntityMappingType entityDescriptor | |
| invalidNaturalIdList | back to summary |
|---|---|
| private List<Resolution> invalidNaturalIdList | |
| naturalIdToPkMap | back to summary |
|---|---|
| private final Map<Resolution, Object> naturalIdToPkMap | |
| persistenceContext | back to summary |
|---|---|
| private final PersistenceContext persistenceContext | |
| pkToNaturalIdMap | back to summary |
|---|---|
| private final Map<Object, Resolution> pkToNaturalIdMap | |
| EntityResolutions | back to summary |
|---|---|
| private EntityResolutions(EntityMappingType entityDescriptor, PersistenceContext persistenceContext) | |
| cache | back to summary |
|---|---|
| public boolean cache(Object pk, Object naturalIdValues) | |
| containsInvalidNaturalIdReference | back to summary |
|---|---|
| public boolean containsInvalidNaturalIdReference(Object naturalIdValues) | |
| getEntityDescriptor | back to summary |
|---|---|
| public EntityMappingType getEntityDescriptor() | |
| getPersister | back to summary |
|---|---|
| public EntityPersister getPersister() | |
| sameAsCached | back to summary |
|---|---|
| public boolean sameAsCached(Object pk, Object naturalIdValues) | |
| stashInvalidNaturalIdReference | back to summary |
|---|---|
| public void stashInvalidNaturalIdReference(Object invalidNaturalIdValues) | |
| unStashInvalidNaturalIdReferences | back to summary |
|---|---|
| public void unStashInvalidNaturalIdReferences() | |
| Modifier and Type | Field and Description |
|---|---|
| private final EntityMappingType | |
| private final int | |
| private final Object | |
| private final PersistenceContext |
| Access | Constructor and Description |
|---|---|
| public | ResolutionImpl(EntityMappingType entityDescriptor, Object naturalIdValue, PersistenceContext persistenceContext)
|
| Modifier and Type | Method and Description |
|---|---|
| public boolean | equals(Object
the reference object with which to compare. obj)Overrides java. |
| public Object | |
| public int | |
| public boolean |
| entityDescriptor | back to summary |
|---|---|
| private final EntityMappingType entityDescriptor | |
| hashCode | back to summary |
|---|---|
| private final int hashCode | |
| naturalIdValue | back to summary |
|---|---|
| private final Object naturalIdValue | |
| persistenceContext | back to summary |
|---|---|
| private final PersistenceContext persistenceContext | |
| ResolutionImpl | back to summary |
|---|---|
| public ResolutionImpl(EntityMappingType entityDescriptor, Object naturalIdValue, PersistenceContext persistenceContext) | |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| getNaturalIdValue | back to summary |
|---|---|
| public Object getNaturalIdValue() Implements org.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| isSame | back to summary |
|---|---|
| public boolean isSame(Object otherValue) Implements org.
| |