Often referred to as the "first level cache".
| Modifier and Type | Class and Description |
|---|---|
| public static interface | PersistenceContext.NaturalIdHelper
Provides centralized access to natural-id-related functionality. |
| Modifier and Type | Field and Description |
|---|---|
| public static final Object | NO_ROW
Marker object used to indicate (via reference checking) that no row was returned. |
| Modifier and Type | Method and Description |
|---|---|
| public void | addChildParent(Object
The child of the relationship child, Object The parent of the relationship parent)Add a child/parent relation to cache for cascading op |
| public PersistentCollection | Returns: the previous collection, it the key was already mapped.Adds a collection in the collections-by-key map. |
| public void | addCollectionHolder(PersistentCollection holder)
Register a PersistentCollection object for an array. |
| public void | addEnhancedProxy(EntityKey key, PersistentAttributeInterceptable entity)
Cross between |
| public void | |
| public void | addEntity(EntityUniqueKey
The unique (non-primary) key under which to add an entity euk, Object The entity instance entity)Add an entity to the cache by unique key |
| public EntityEntry | |
| public EntityEntry | addEntry(final Object entity, final Status status, final Object[] loadedState, final Object rowId, final Serializable id, final Object version, final LockMode lockMode, final boolean existsInDatabase, final EntityPersister persister, final boolean disableVersionIncrement)
Generates an appropriate EntityEntry instance and adds it to the event source's internal caches. |
| public CollectionEntry | addInitializedCollection(CollectionPersister persister, PersistentCollection collection, Serializable id)
add a collection we just pulled out of the cache (does not need initializing) |
| public void | addInitializedDetachedCollection(CollectionPersister collectionPersister, PersistentCollection collection)
add an (initialized) collection that was created by another session and passed into update() (ie. |
| public void | addNewCollection(CollectionPersister persister, PersistentCollection
The collection to be associated with the persistence context collection)Add a new collection (ie. |
| public void | addNonLazyCollection(PersistentCollection collection)
Register a collection for non-lazy loading at the end of the two-phase load |
| public void | addNullProperty(EntityKey ownerKey, String propertyName)
Record the fact that the association belonging to the keyed entity is null. |
| public void | |
| public void | addUninitializedCollection(CollectionPersister persister, PersistentCollection collection, Serializable id)
add a collection we just loaded up (still needs initializing) |
| public void | addUninitializedDetachedCollection(CollectionPersister persister, PersistentCollection collection)
add a detached uninitialized collection |
| public void | addUnownedCollection(CollectionKey
The collection key under which to add the collection key, PersistentCollection The collection to add collection)Add a collection which has no owner loaded |
| public void | |
| public void | |
| public void | |
| public void | checkUniqueness(EntityKey key, Object
The entity reference against which to perform the uniqueness check. object)Attempts to check whether the given key represents an entity already loaded within the current session. |
| public void | |
| public void | |
| public boolean | containsCollection(PersistentCollection collection)
Is the given collection associated with this persistence context? |
| public boolean | Returns: true indicates an entity was found; otherwise falseThe key under which to look for an entity key)Is there an entity with the given key in the persistence context |
| public boolean | Returns: true if the EntityKey had been registered before usingregisterNullifiableEntityKey(EntityKey)a supplier for the EntityKey; this allows to not always needing to create the key;
for example if the map is known to be empty there is no need to create one to check. sek)Checks if a certain |
| public boolean | |
| public int | |
| public void | forEachCollectionEntry(BiConsumer<PersistentCollection, CollectionEntry>
the lambda to apply on each PersistentCollection,CollectionEntry map entry of the PersistenceContext. action, boolean set this to false for improved efficiency, but that would make it illegal to make changes to the underlying collectionEntries map. concurrent)Execute some action on each entry of the collectionEntries map, optionally iterating on a defensive copy. |
| public BatchFetchQueue | Returns: The batch fetch queue in effect for this persistence contextGet the |
| public Object[] | Returns: The cached snapshotThe entity key for which to retrieve the cached snapshot key)Retrieve the cached database snapshot for the requested entity key. |
| public int | |
| public PersistentCollection | getCollection(CollectionKey collectionKey)
Get the collection instance associated with the CollectionKey |
| public Map | getCollectionEntries()
Get the mapping from collection instance to collection entry
|
| public int | Returns: the sizeThe size of the internal map storing all collection entries. |
| public CollectionEntry | Returns: The matching collection entryThe persistent collection instance for which to locate the collection entry coll)Get the collection entry for a persistent collection |
| public CollectionEntry | getCollectionEntryOrNull(Object collection)
Get the collection entry for a collection passed to filter, which might be a collection wrapper, an array, or an unwrapped collection. |
| public PersistentCollection | |
| public Object | getCollectionOwner(Serializable key, CollectionPersister collectionPersister)
Get the entity that owns this persistent collection |
| public Map | getCollectionsByKey()
Deprecated
this method should be removed; alternative methods are available that better express the intent, allowing
for better optimisations.
Get the mapping from collection key to collection instance
|
| public Object[] | Returns: The entity's (non-cached) snapshotThe identifier of the entity for which to grab a snapshot id, EntityPersister The persister of the entity. persister)Get the current state of the entity as known to the underlying database, or null if there is no corresponding row |
| public Map | getEntitiesByKey()
Deprecated
this will be removed: it provides too wide access, making it hard to optimise the internals
for specific access needs. Consider using #iterateEntities instead.
Get the mapping from key value to entity instance
|
| public Object | |
| public Object | Returns: The located entityThe unique (non-primary) key under which to look for an entity euk)Get an entity cached by unique key |
| public Map | getEntityEntries()
Deprecated
Due to the introduction of EntityEntryContext and bytecode enhancement; only valid really for
sizing, see
Get the mapping from entity instance to entity entry
getNumberOfManagedEntities.
|
| public EntityEntry | Returns: The entryThe entity instance for which to locate the corresponding entry entity)Retrieve the |
| public Object | getIndexInOwner(String entity, String property, Object childObject, Map<K, V> mergeMap)
Search the persistence context for an index of the child object, given a collection role |
| public LoadContexts | |
| public Serializable | Returns: the owner ID if available from the collection's loaded key; otherwise, returns nullThe persistent collection collection)Get the ID for the entity that owned this persistent collection when it was loaded |
| public Object | Returns: the owner if its entity ID is available from the collection's loaded key and the owner entity is in the persistence context; otherwise, returns nullThe persistent collection collection)Get the entity that owned this persistent collection when it was loaded |
| public PersistenceContext. | Returns: This persistence context's natural-id helperAccess to the natural-id helper for this persistence context |
| public Object[] | Returns: The current (non-cached) snapshot of the entity's natural id state.The identifier of the entity for which to grab a snapshot id, EntityPersister The persister of the entity. persister)Get the values of the natural id fields as known to the underlying database, or null if the entity has no natural id or there is no corresponding row. |
| public HashSet | getNullifiableEntityKeys()
Retrieve the set of EntityKeys representing nullifiable references
|
| public int | |
| public Serializable | Returns: The id of the entityName instance which is said to own the child; null if an appropriate owner not located.The entity name for the entity type which would own the child entityName, String The name of the property on the owning entity type which would name this child association. propertyName, Object The child entity instance for which to locate the owner instance id. childEntity, Map<K, V> A map of non-persistent instances from an on-going merge operation (possibly null). mergeMap)Search this persistence context for an associated entity instance which is considered the "owner" of the given childEntity, and return that owner's id value. |
| public Object | |
| public SharedSessionContractImplementor | |
| public Serializable | |
| public boolean | |
| public int | |
| public void | initializeNonLazyCollections()
Force initialization of all non-lazy collections encountered during the current two-phase load (actually, this is a no-op, unless this is the "outermost" load) |
| public boolean | Returns: true, loaded entities/proxies will be made read-only by default; false, loaded entities/proxies will be made modifiable by default.Will entities and proxies that are loaded into this persistence context be made read-only by default? |
| public boolean | Returns: true indicates a matching entry was found.The entity instance for which to check for an entry entity)Is there an |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | isPropertyNull(EntityKey ownerKey, String propertyName)
Is the association property belonging to the keyed entity null? |
| public boolean | Returns: true if the object is read-only; otherwise false to indicate that the object is
modifiable.an entity or proxy entityOrProxy)Is the entity or proxy read-only? |
| public boolean | |
| public Iterator | |
| public Object | Returns: An appropriately narrowed instance.The proxy instance to be narrowed. proxy, EntityPersister The persister for the proxied entity. persister, EntityKey The internal cache key for the proxied entity. key, Object (optional) the actual proxied entity instance. object)If the existing proxy is insufficiently "narrow" (derived), instantiate a new proxy and overwrite the registration of the old one. |
| public Object | proxyFor(EntityPersister persister, EntityKey key, Object impl)
Return the existing proxy associated with the given EntityKey, or the third argument (the entity associated with the key) if no proxy exists. |
| public Object | |
| public boolean | Returns: Whether the passed value represented an actual proxy which got initialized.The possible proxy to be reassociated. value)Takes the given object and, if it represents a proxy, reassociates it with this event source. |
| public void | reassociateProxy(Object value, Serializable id)
If a deleted entity instance is re-saved, and it has a proxy, we need to reset the identifier of the proxy |
| public Map. | reentrantSafeEntityEntries()
Provides access to the entity/EntityEntry combos associated with the persistence context in a manner that is safe from reentrant access. |
| public void | registerInsertedKey(EntityPersister
The entity persister persister, Serializable The id id)Register keys inserted during the current transaction |
| public void | registerNullifiableEntityKey(EntityKey key)
Registers an |
| public void | |
| public void | removeCollectionByKey(CollectionKey
the key to clear collectionKey)Remove a collection-by-key mapping. |
| public CollectionEntry | Returns: the matchingCollectionEntry, if any was removed.the collection to remove collection)Remove a |
| public PersistentCollection | removeCollectionHolder(Object array)
Remove the mapping of collection to holder during eviction of the owning entity |
| public Object | Returns: The matching entityThe key whose matching entity should be removed key)Remove an entity. |
| public EntityEntry | Returns: The matching entryThe entity instance for which to remove the corresponding entry entity)Remove an entity entry from the session cache |
| public Object | Returns: The proxy reference.The key of the entity proxy to be removed key)Remove a proxy from the session cache. |
| public void | |
| public void | setDefaultReadOnly(boolean
true, the default for loaded entities/proxies is read-only;
false, the default for loaded entities/proxies is modifiable readOnly)Change the default for entities and proxies loaded into this persistence context from modifiable to read-only mode, or from modifiable to read-only mode. |
| public void | setEntryStatus(EntityEntry
The entry for which to set the status entry, Status The new status status)Set the status of an entry |
| public void | |
| public void | setReadOnly(Object
an entity or proxy entityOrProxy, boolean if readOnly)true, the entity or proxy is made read-only; otherwise, the entity or proxy is made
modifiable.Set an unmodified persistent object to read-only mode, or a read-only object to modifiable mode. |
| public String | Returns: a string representation of the object.Returns a string representation of the object. |
| public Object | |
| public Object | Returns: The unproxied instance.The reference to be unproxied if it currently represents a proxy. maybeProxy)Possibly unproxy the given reference and reassociate it with the current session. |
| public PersistentCollection | Returns: The unowned collection, ornullThe collection key for which to locate a collection collection key)Take ownership of a previously unowned collection, if one. |
| public boolean | Returns: True if inserted during this transaction, false otherwise.The entity persister persister, Serializable The id id)Allows callers to check to see if the identified entity was inserted during the current transaction. |