mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-27 14:30:16 +00:00
HHH-12464 - NPE upon insert & delete with identity generated id
This commit is contained in:
parent
2bf85ffd2a
commit
0a4f02801d
@ -12,6 +12,7 @@
|
||||
import org.hibernate.action.spi.AfterTransactionCompletionProcess;
|
||||
import org.hibernate.action.spi.BeforeTransactionCompletionProcess;
|
||||
import org.hibernate.action.spi.Executable;
|
||||
import org.hibernate.engine.spi.EntityEntry;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.event.service.spi.EventListenerGroup;
|
||||
import org.hibernate.event.service.spi.EventListenerRegistry;
|
||||
@ -21,6 +22,8 @@
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.pretty.MessageHelper;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
* Base class for actions relating to insert/update/delete of an entity
|
||||
* instance.
|
||||
@ -29,6 +32,7 @@
|
||||
*/
|
||||
public abstract class EntityAction
|
||||
implements Executable, Serializable, Comparable, AfterTransactionCompletionProcess {
|
||||
private static final Logger LOG = Logger.getLogger(EntityAction.class);
|
||||
|
||||
private final String entityName;
|
||||
private final Serializable id;
|
||||
@ -97,7 +101,19 @@ public String getEntityName() {
|
||||
*/
|
||||
public final Serializable getId() {
|
||||
if ( id instanceof DelayedPostInsertIdentifier ) {
|
||||
final Serializable eeId = session.getPersistenceContext().getEntry( instance ).getId();
|
||||
final EntityEntry entry = session.getPersistenceContext().getEntry( instance );
|
||||
if ( entry == null ) {
|
||||
if ( LOG.isDebugEnabled() ) {
|
||||
LOG.debugf(
|
||||
"Skipping action - the persistence context does not contain any entry for the entity [%s]. This may occur if an entity is created and then deleted in the same transaction/flush.",
|
||||
instance
|
||||
);
|
||||
}
|
||||
// If an Entity is created and then deleted in the same Transaction, when Action#postDelete() calls this method the persistence context
|
||||
// does not contain anymore an entry.
|
||||
return null;
|
||||
}
|
||||
final Serializable eeId = entry.getId();
|
||||
return eeId instanceof DelayedPostInsertIdentifier ? null : eeId;
|
||||
}
|
||||
return id;
|
||||
|
@ -39,24 +39,24 @@ public interface PersistenceContext {
|
||||
/**
|
||||
* Marker object used to indicate (via reference checking) that no row was returned.
|
||||
*/
|
||||
public static final Object NO_ROW = new MarkerObject( "NO_ROW" );
|
||||
Object NO_ROW = new MarkerObject( "NO_ROW" );
|
||||
|
||||
@SuppressWarnings( {"UnusedDeclaration"})
|
||||
public boolean isStateless();
|
||||
boolean isStateless();
|
||||
|
||||
/**
|
||||
* Get the session to which this persistence context is bound.
|
||||
*
|
||||
* @return The session.
|
||||
*/
|
||||
public SharedSessionContractImplementor getSession();
|
||||
SharedSessionContractImplementor getSession();
|
||||
|
||||
/**
|
||||
* Retrieve this persistence context's managed load context.
|
||||
*
|
||||
* @return The load context
|
||||
*/
|
||||
public LoadContexts getLoadContexts();
|
||||
LoadContexts getLoadContexts();
|
||||
|
||||
/**
|
||||
* Add a collection which has no owner loaded
|
||||
@ -64,7 +64,7 @@ public interface PersistenceContext {
|
||||
* @param key The collection key under which to add the collection
|
||||
* @param collection The collection to add
|
||||
*/
|
||||
public void addUnownedCollection(CollectionKey key, PersistentCollection collection);
|
||||
void addUnownedCollection(CollectionKey key, PersistentCollection collection);
|
||||
|
||||
/**
|
||||
* Take ownership of a previously unowned collection, if one. This method returns {@code null} if no such
|
||||
@ -76,25 +76,25 @@ public interface PersistenceContext {
|
||||
*
|
||||
* @return The unowned collection, or {@code null}
|
||||
*/
|
||||
public PersistentCollection useUnownedCollection(CollectionKey key);
|
||||
PersistentCollection useUnownedCollection(CollectionKey key);
|
||||
|
||||
/**
|
||||
* Get the {@link BatchFetchQueue}, instantiating one if necessary.
|
||||
*
|
||||
* @return The batch fetch queue in effect for this persistence context
|
||||
*/
|
||||
public BatchFetchQueue getBatchFetchQueue();
|
||||
BatchFetchQueue getBatchFetchQueue();
|
||||
|
||||
/**
|
||||
* Clear the state of the persistence context
|
||||
*/
|
||||
public void clear();
|
||||
void clear();
|
||||
|
||||
/**
|
||||
* @return false if we know for certain that all the entities are read-only
|
||||
*/
|
||||
@SuppressWarnings( {"UnusedDeclaration"})
|
||||
public boolean hasNonReadOnlyEntities();
|
||||
boolean hasNonReadOnlyEntities();
|
||||
|
||||
/**
|
||||
* Set the status of an entry
|
||||
@ -102,12 +102,12 @@ public interface PersistenceContext {
|
||||
* @param entry The entry for which to set the status
|
||||
* @param status The new status
|
||||
*/
|
||||
public void setEntryStatus(EntityEntry entry, Status status);
|
||||
void setEntryStatus(EntityEntry entry, Status status);
|
||||
|
||||
/**
|
||||
* Called after transactions end
|
||||
*/
|
||||
public void afterTransactionCompletion();
|
||||
void afterTransactionCompletion();
|
||||
|
||||
/**
|
||||
* Get the current state of the entity as known to the underlying database, or null if there is no
|
||||
@ -120,7 +120,7 @@ public interface PersistenceContext {
|
||||
*
|
||||
* @see #getCachedDatabaseSnapshot
|
||||
*/
|
||||
public Object[] getDatabaseSnapshot(Serializable id, EntityPersister persister);
|
||||
Object[] getDatabaseSnapshot(Serializable id, EntityPersister persister);
|
||||
|
||||
/**
|
||||
* Retrieve the cached database snapshot for the requested entity key.
|
||||
@ -133,7 +133,7 @@ public interface PersistenceContext {
|
||||
* @return The cached snapshot
|
||||
* @throws IllegalStateException if the cached snapshot was == {@link #NO_ROW}.
|
||||
*/
|
||||
public Object[] getCachedDatabaseSnapshot(EntityKey key);
|
||||
Object[] getCachedDatabaseSnapshot(EntityKey key);
|
||||
|
||||
/**
|
||||
* Get the values of the natural id fields as known to the underlying database, or null if the entity has no
|
||||
@ -144,7 +144,7 @@ public interface PersistenceContext {
|
||||
*
|
||||
* @return The current (non-cached) snapshot of the entity's natural id state.
|
||||
*/
|
||||
public Object[] getNaturalIdSnapshot(Serializable id, EntityPersister persister);
|
||||
Object[] getNaturalIdSnapshot(Serializable id, EntityPersister persister);
|
||||
|
||||
/**
|
||||
* Add a canonical mapping from entity key to entity instance
|
||||
@ -152,7 +152,7 @@ public interface PersistenceContext {
|
||||
* @param key The key under which to add an entity
|
||||
* @param entity The entity instance to add
|
||||
*/
|
||||
public void addEntity(EntityKey key, Object entity);
|
||||
void addEntity(EntityKey key, Object entity);
|
||||
|
||||
/**
|
||||
* Get the entity instance associated with the given key
|
||||
@ -161,7 +161,7 @@ public interface PersistenceContext {
|
||||
*
|
||||
* @return The matching entity, or {@code null}
|
||||
*/
|
||||
public Object getEntity(EntityKey key);
|
||||
Object getEntity(EntityKey key);
|
||||
|
||||
/**
|
||||
* Is there an entity with the given key in the persistence context
|
||||
@ -170,7 +170,7 @@ public interface PersistenceContext {
|
||||
*
|
||||
* @return {@code true} indicates an entity was found; otherwise {@code false}
|
||||
*/
|
||||
public boolean containsEntity(EntityKey key);
|
||||
boolean containsEntity(EntityKey key);
|
||||
|
||||
/**
|
||||
* Remove an entity. Also clears up all other state associated with the entity aside from the {@link EntityEntry}
|
||||
@ -179,7 +179,7 @@ public interface PersistenceContext {
|
||||
*
|
||||
* @return The matching entity
|
||||
*/
|
||||
public Object removeEntity(EntityKey key);
|
||||
Object removeEntity(EntityKey key);
|
||||
|
||||
/**
|
||||
* Add an entity to the cache by unique key
|
||||
@ -187,7 +187,7 @@ public interface PersistenceContext {
|
||||
* @param euk The unique (non-primary) key under which to add an entity
|
||||
* @param entity The entity instance
|
||||
*/
|
||||
public void addEntity(EntityUniqueKey euk, Object entity);
|
||||
void addEntity(EntityUniqueKey euk, Object entity);
|
||||
|
||||
/**
|
||||
* Get an entity cached by unique key
|
||||
@ -196,7 +196,7 @@ public interface PersistenceContext {
|
||||
*
|
||||
* @return The located entity
|
||||
*/
|
||||
public Object getEntity(EntityUniqueKey euk);
|
||||
Object getEntity(EntityUniqueKey euk);
|
||||
|
||||
/**
|
||||
* Retrieve the {@link EntityEntry} representation of the given entity.
|
||||
@ -204,7 +204,7 @@ public interface PersistenceContext {
|
||||
* @param entity The entity instance for which to locate the corresponding entry
|
||||
* @return The entry
|
||||
*/
|
||||
public EntityEntry getEntry(Object entity);
|
||||
EntityEntry getEntry(Object entity);
|
||||
|
||||
/**
|
||||
* Remove an entity entry from the session cache
|
||||
@ -212,7 +212,7 @@ public interface PersistenceContext {
|
||||
* @param entity The entity instance for which to remove the corresponding entry
|
||||
* @return The matching entry
|
||||
*/
|
||||
public EntityEntry removeEntry(Object entity);
|
||||
EntityEntry removeEntry(Object entity);
|
||||
|
||||
/**
|
||||
* Is there an {@link EntityEntry} registration for this entity instance?
|
||||
@ -221,7 +221,7 @@ public interface PersistenceContext {
|
||||
*
|
||||
* @return {@code true} indicates a matching entry was found.
|
||||
*/
|
||||
public boolean isEntryFor(Object entity);
|
||||
boolean isEntryFor(Object entity);
|
||||
|
||||
/**
|
||||
* Get the collection entry for a persistent collection
|
||||
@ -230,7 +230,7 @@ public interface PersistenceContext {
|
||||
*
|
||||
* @return The matching collection entry
|
||||
*/
|
||||
public CollectionEntry getCollectionEntry(PersistentCollection coll);
|
||||
CollectionEntry getCollectionEntry(PersistentCollection coll);
|
||||
|
||||
/**
|
||||
* Adds an entity to the internal caches.
|
||||
@ -250,7 +250,7 @@ EntityEntry addEntity(
|
||||
* Generates an appropriate EntityEntry instance and adds it
|
||||
* to the event source's internal caches.
|
||||
*/
|
||||
public EntityEntry addEntry(
|
||||
EntityEntry addEntry(
|
||||
final Object entity,
|
||||
final Status status,
|
||||
final Object[] loadedState,
|
||||
@ -265,12 +265,12 @@ public EntityEntry addEntry(
|
||||
/**
|
||||
* Is the given collection associated with this persistence context?
|
||||
*/
|
||||
public boolean containsCollection(PersistentCollection collection);
|
||||
boolean containsCollection(PersistentCollection collection);
|
||||
|
||||
/**
|
||||
* Is the given proxy associated with this persistence context?
|
||||
*/
|
||||
public boolean containsProxy(Object proxy);
|
||||
boolean containsProxy(Object proxy);
|
||||
|
||||
/**
|
||||
* Takes the given object and, if it represents a proxy, reassociates it with this event source.
|
||||
@ -279,20 +279,20 @@ public EntityEntry addEntry(
|
||||
* @return Whether the passed value represented an actual proxy which got initialized.
|
||||
* @throws MappingException
|
||||
*/
|
||||
public boolean reassociateIfUninitializedProxy(Object value) throws MappingException;
|
||||
boolean reassociateIfUninitializedProxy(Object value) throws MappingException;
|
||||
|
||||
/**
|
||||
* If a deleted entity instance is re-saved, and it has a proxy, we need to
|
||||
* reset the identifier of the proxy
|
||||
*/
|
||||
public void reassociateProxy(Object value, Serializable id) throws MappingException;
|
||||
void reassociateProxy(Object value, Serializable id) throws MappingException;
|
||||
|
||||
/**
|
||||
* Get the entity instance underlying the given proxy, throwing
|
||||
* an exception if the proxy is uninitialized. If the given object
|
||||
* is not a proxy, simply return the argument.
|
||||
*/
|
||||
public Object unproxy(Object maybeProxy) throws HibernateException;
|
||||
Object unproxy(Object maybeProxy) throws HibernateException;
|
||||
|
||||
/**
|
||||
* Possibly unproxy the given reference and reassociate it with the current session.
|
||||
@ -301,7 +301,7 @@ public EntityEntry addEntry(
|
||||
* @return The unproxied instance.
|
||||
* @throws HibernateException
|
||||
*/
|
||||
public Object unproxyAndReassociate(Object maybeProxy) throws HibernateException;
|
||||
Object unproxyAndReassociate(Object maybeProxy) throws HibernateException;
|
||||
|
||||
/**
|
||||
* Attempts to check whether the given key represents an entity already loaded within the
|
||||
@ -311,7 +311,7 @@ public EntityEntry addEntry(
|
||||
*
|
||||
* @throws HibernateException
|
||||
*/
|
||||
public void checkUniqueness(EntityKey key, Object object) throws HibernateException;
|
||||
void checkUniqueness(EntityKey key, Object object) throws HibernateException;
|
||||
|
||||
/**
|
||||
* If the existing proxy is insufficiently "narrow" (derived), instantiate a new proxy
|
||||
@ -326,7 +326,7 @@ public EntityEntry addEntry(
|
||||
* @return An appropriately narrowed instance.
|
||||
* @throws HibernateException
|
||||
*/
|
||||
public Object narrowProxy(Object proxy, EntityPersister persister, EntityKey key, Object object)
|
||||
Object narrowProxy(Object proxy, EntityPersister persister, EntityKey key, Object object)
|
||||
throws HibernateException;
|
||||
|
||||
/**
|
||||
@ -334,7 +334,7 @@ public Object narrowProxy(Object proxy, EntityPersister persister, EntityKey key
|
||||
* third argument (the entity associated with the key) if no proxy exists. Init
|
||||
* the proxy to the target implementation, if necessary.
|
||||
*/
|
||||
public Object proxyFor(EntityPersister persister, EntityKey key, Object impl)
|
||||
Object proxyFor(EntityPersister persister, EntityKey key, Object impl)
|
||||
throws HibernateException;
|
||||
|
||||
/**
|
||||
@ -342,12 +342,12 @@ public Object proxyFor(EntityPersister persister, EntityKey key, Object impl)
|
||||
* argument (the entity associated with the key) if no proxy exists.
|
||||
* (slower than the form above)
|
||||
*/
|
||||
public Object proxyFor(Object impl) throws HibernateException;
|
||||
Object proxyFor(Object impl) throws HibernateException;
|
||||
|
||||
/**
|
||||
* Get the entity that owns this persistent collection
|
||||
*/
|
||||
public Object getCollectionOwner(Serializable key, CollectionPersister collectionPersister)
|
||||
Object getCollectionOwner(Serializable key, CollectionPersister collectionPersister)
|
||||
throws MappingException;
|
||||
|
||||
/**
|
||||
@ -365,18 +365,18 @@ public Object getCollectionOwner(Serializable key, CollectionPersister collectio
|
||||
* @param collection The persistent collection
|
||||
* @return the owner ID if available from the collection's loaded key; otherwise, returns null
|
||||
*/
|
||||
public Serializable getLoadedCollectionOwnerIdOrNull(PersistentCollection collection);
|
||||
Serializable getLoadedCollectionOwnerIdOrNull(PersistentCollection collection);
|
||||
|
||||
/**
|
||||
* add a collection we just loaded up (still needs initializing)
|
||||
*/
|
||||
public void addUninitializedCollection(CollectionPersister persister,
|
||||
void addUninitializedCollection(CollectionPersister persister,
|
||||
PersistentCollection collection, Serializable id);
|
||||
|
||||
/**
|
||||
* add a detached uninitialized collection
|
||||
*/
|
||||
public void addUninitializedDetachedCollection(CollectionPersister persister,
|
||||
void addUninitializedDetachedCollection(CollectionPersister persister,
|
||||
PersistentCollection collection);
|
||||
|
||||
/**
|
||||
@ -384,79 +384,79 @@ public void addUninitializedDetachedCollection(CollectionPersister persister,
|
||||
* application, with no database state or snapshot)
|
||||
* @param collection The collection to be associated with the persistence context
|
||||
*/
|
||||
public void addNewCollection(CollectionPersister persister, PersistentCollection collection)
|
||||
void addNewCollection(CollectionPersister persister, PersistentCollection collection)
|
||||
throws HibernateException;
|
||||
|
||||
/**
|
||||
* add an (initialized) collection that was created by another session and passed
|
||||
* into update() (ie. one with a snapshot and existing state on the database)
|
||||
*/
|
||||
public void addInitializedDetachedCollection(CollectionPersister collectionPersister,
|
||||
void addInitializedDetachedCollection(CollectionPersister collectionPersister,
|
||||
PersistentCollection collection) throws HibernateException;
|
||||
|
||||
/**
|
||||
* add a collection we just pulled out of the cache (does not need initializing)
|
||||
*/
|
||||
public CollectionEntry addInitializedCollection(CollectionPersister persister,
|
||||
CollectionEntry addInitializedCollection(CollectionPersister persister,
|
||||
PersistentCollection collection, Serializable id) throws HibernateException;
|
||||
|
||||
/**
|
||||
* Get the collection instance associated with the <tt>CollectionKey</tt>
|
||||
*/
|
||||
public PersistentCollection getCollection(CollectionKey collectionKey);
|
||||
PersistentCollection getCollection(CollectionKey collectionKey);
|
||||
|
||||
/**
|
||||
* Register a collection for non-lazy loading at the end of the
|
||||
* two-phase load
|
||||
*/
|
||||
public void addNonLazyCollection(PersistentCollection collection);
|
||||
void addNonLazyCollection(PersistentCollection collection);
|
||||
|
||||
/**
|
||||
* 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 void initializeNonLazyCollections() throws HibernateException;
|
||||
void initializeNonLazyCollections() throws HibernateException;
|
||||
|
||||
/**
|
||||
* Get the <tt>PersistentCollection</tt> object for an array
|
||||
*/
|
||||
public PersistentCollection getCollectionHolder(Object array);
|
||||
PersistentCollection getCollectionHolder(Object array);
|
||||
|
||||
/**
|
||||
* Register a <tt>PersistentCollection</tt> object for an array.
|
||||
* Associates a holder with an array - MUST be called after loading
|
||||
* array, since the array instance is not created until endLoad().
|
||||
*/
|
||||
public void addCollectionHolder(PersistentCollection holder);
|
||||
void addCollectionHolder(PersistentCollection holder);
|
||||
|
||||
/**
|
||||
* Remove the mapping of collection to holder during eviction
|
||||
* of the owning entity
|
||||
*/
|
||||
public PersistentCollection removeCollectionHolder(Object array);
|
||||
PersistentCollection removeCollectionHolder(Object array);
|
||||
|
||||
/**
|
||||
* Get the snapshot of the pre-flush collection state
|
||||
*/
|
||||
public Serializable getSnapshot(PersistentCollection coll);
|
||||
Serializable getSnapshot(PersistentCollection coll);
|
||||
|
||||
/**
|
||||
* Get the collection entry for a collection passed to filter,
|
||||
* which might be a collection wrapper, an array, or an unwrapped
|
||||
* collection. Return null if there is no entry.
|
||||
*/
|
||||
public CollectionEntry getCollectionEntryOrNull(Object collection);
|
||||
CollectionEntry getCollectionEntryOrNull(Object collection);
|
||||
|
||||
/**
|
||||
* Get an existing proxy by key
|
||||
*/
|
||||
public Object getProxy(EntityKey key);
|
||||
Object getProxy(EntityKey key);
|
||||
|
||||
/**
|
||||
* Add a proxy to the session cache
|
||||
*/
|
||||
public void addProxy(EntityKey key, Object proxy);
|
||||
void addProxy(EntityKey key, Object proxy);
|
||||
|
||||
/**
|
||||
* Remove a proxy from the session cache.
|
||||
@ -467,17 +467,17 @@ public CollectionEntry addInitializedCollection(CollectionPersister persister,
|
||||
* @param key The key of the entity proxy to be removed
|
||||
* @return The proxy reference.
|
||||
*/
|
||||
public Object removeProxy(EntityKey key);
|
||||
Object removeProxy(EntityKey key);
|
||||
|
||||
/**
|
||||
* Retrieve the set of EntityKeys representing nullifiable references
|
||||
*/
|
||||
public HashSet getNullifiableEntityKeys();
|
||||
HashSet getNullifiableEntityKeys();
|
||||
|
||||
/**
|
||||
* Get the mapping from key value to entity instance
|
||||
*/
|
||||
public Map getEntitiesByKey();
|
||||
Map getEntitiesByKey();
|
||||
|
||||
/**
|
||||
* Provides access to the entity/EntityEntry combos associated with the persistence context in a manner that
|
||||
@ -485,7 +485,7 @@ public CollectionEntry addInitializedCollection(CollectionPersister persister,
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Map.Entry<Object,EntityEntry>[] reentrantSafeEntityEntries();
|
||||
Map.Entry<Object,EntityEntry>[] reentrantSafeEntityEntries();
|
||||
|
||||
/**
|
||||
* Get the mapping from entity instance to entity entry
|
||||
@ -495,66 +495,66 @@ public CollectionEntry addInitializedCollection(CollectionPersister persister,
|
||||
* {@link #reentrantSafeEntityEntries}
|
||||
*/
|
||||
@Deprecated
|
||||
public Map getEntityEntries();
|
||||
Map getEntityEntries();
|
||||
|
||||
public int getNumberOfManagedEntities();
|
||||
int getNumberOfManagedEntities();
|
||||
|
||||
/**
|
||||
* Get the mapping from collection instance to collection entry
|
||||
*/
|
||||
public Map getCollectionEntries();
|
||||
Map getCollectionEntries();
|
||||
|
||||
/**
|
||||
* Get the mapping from collection key to collection instance
|
||||
*/
|
||||
public Map getCollectionsByKey();
|
||||
Map getCollectionsByKey();
|
||||
|
||||
/**
|
||||
* How deep are we cascaded?
|
||||
*/
|
||||
public int getCascadeLevel();
|
||||
int getCascadeLevel();
|
||||
|
||||
/**
|
||||
* Called before cascading
|
||||
*/
|
||||
public int incrementCascadeLevel();
|
||||
int incrementCascadeLevel();
|
||||
|
||||
/**
|
||||
* Called after cascading
|
||||
*/
|
||||
public int decrementCascadeLevel();
|
||||
int decrementCascadeLevel();
|
||||
|
||||
/**
|
||||
* Is a flush cycle currently in process?
|
||||
*/
|
||||
@SuppressWarnings( {"UnusedDeclaration"})
|
||||
public boolean isFlushing();
|
||||
boolean isFlushing();
|
||||
|
||||
/**
|
||||
* Called before and after the flushcycle
|
||||
*/
|
||||
public void setFlushing(boolean flushing);
|
||||
void setFlushing(boolean flushing);
|
||||
|
||||
/**
|
||||
* Call this before begining a two-phase load
|
||||
*/
|
||||
public void beforeLoad();
|
||||
void beforeLoad();
|
||||
|
||||
/**
|
||||
* Call this after finishing a two-phase load
|
||||
*/
|
||||
public void afterLoad();
|
||||
void afterLoad();
|
||||
|
||||
/**
|
||||
* Is in a two-phase load?
|
||||
*/
|
||||
public boolean isLoadFinished();
|
||||
boolean isLoadFinished();
|
||||
/**
|
||||
* Returns a string representation of the object.
|
||||
*
|
||||
* @return a string representation of the object.
|
||||
*/
|
||||
public String toString();
|
||||
String toString();
|
||||
|
||||
/**
|
||||
* Search <tt>this</tt> persistence context for an associated entity instance which is considered the "owner" of
|
||||
@ -577,24 +577,24 @@ public CollectionEntry addInitializedCollection(CollectionPersister persister,
|
||||
* @return The id of the entityName instance which is said to own the child; null if an appropriate owner not
|
||||
* located.
|
||||
*/
|
||||
public Serializable getOwnerId(String entityName, String propertyName, Object childEntity, Map mergeMap);
|
||||
Serializable getOwnerId(String entityName, String propertyName, Object childEntity, Map mergeMap);
|
||||
|
||||
/**
|
||||
* Search the persistence context for an index of the child object,
|
||||
* given a collection role
|
||||
*/
|
||||
public Object getIndexInOwner(String entity, String property, Object childObject, Map mergeMap);
|
||||
Object getIndexInOwner(String entity, String property, Object childObject, Map mergeMap);
|
||||
|
||||
/**
|
||||
* Record the fact that the association belonging to the keyed
|
||||
* entity is null.
|
||||
*/
|
||||
public void addNullProperty(EntityKey ownerKey, String propertyName);
|
||||
void addNullProperty(EntityKey ownerKey, String propertyName);
|
||||
|
||||
/**
|
||||
* Is the association property belonging to the keyed entity null?
|
||||
*/
|
||||
public boolean isPropertyNull(EntityKey ownerKey, String propertyName);
|
||||
boolean isPropertyNull(EntityKey ownerKey, String propertyName);
|
||||
|
||||
/**
|
||||
* Will entities and proxies that are loaded into this persistence
|
||||
@ -610,7 +610,7 @@ public CollectionEntry addInitializedCollection(CollectionPersister persister,
|
||||
*
|
||||
* @see org.hibernate.Session#isDefaultReadOnly()
|
||||
*/
|
||||
public boolean isDefaultReadOnly();
|
||||
boolean isDefaultReadOnly();
|
||||
|
||||
/**
|
||||
* Change the default for entities and proxies loaded into this persistence
|
||||
@ -639,7 +639,7 @@ public CollectionEntry addInitializedCollection(CollectionPersister persister,
|
||||
*
|
||||
* @see org.hibernate.Session#setDefaultReadOnly(boolean)
|
||||
*/
|
||||
public void setDefaultReadOnly(boolean readOnly);
|
||||
void setDefaultReadOnly(boolean readOnly);
|
||||
|
||||
/**
|
||||
* Is the entity or proxy read-only?
|
||||
@ -652,7 +652,7 @@ public CollectionEntry addInitializedCollection(CollectionPersister persister,
|
||||
* @return {@code true} if the object is read-only; otherwise {@code false} to indicate that the object is
|
||||
* modifiable.
|
||||
*/
|
||||
public boolean isReadOnly(Object entityOrProxy);
|
||||
boolean isReadOnly(Object entityOrProxy);
|
||||
|
||||
/**
|
||||
* Set an unmodified persistent object to read-only mode, or a read-only
|
||||
@ -677,7 +677,7 @@ public CollectionEntry addInitializedCollection(CollectionPersister persister,
|
||||
* @see org.hibernate.Session#setReadOnly
|
||||
* @see org.hibernate.Query#setReadOnly
|
||||
*/
|
||||
public void setReadOnly(Object entityOrProxy, boolean readOnly);
|
||||
void setReadOnly(Object entityOrProxy, boolean readOnly);
|
||||
|
||||
void replaceDelayedEntityIdentityInsertKeys(EntityKey oldKey, Serializable generatedId);
|
||||
|
||||
@ -687,14 +687,14 @@ public CollectionEntry addInitializedCollection(CollectionPersister persister,
|
||||
* @param child The child of the relationship
|
||||
* @param parent The parent of the relationship
|
||||
*/
|
||||
public void addChildParent(Object child, Object parent);
|
||||
void addChildParent(Object child, Object parent);
|
||||
|
||||
/**
|
||||
* Remove child/parent relation from cache
|
||||
*
|
||||
* @param child The child to be removed.
|
||||
*/
|
||||
public void removeChildParent(Object child);
|
||||
void removeChildParent(Object child);
|
||||
|
||||
/**
|
||||
* Register keys inserted during the current transaction
|
||||
@ -702,7 +702,7 @@ public CollectionEntry addInitializedCollection(CollectionPersister persister,
|
||||
* @param persister The entity persister
|
||||
* @param id The id
|
||||
*/
|
||||
public void registerInsertedKey(EntityPersister persister, Serializable id);
|
||||
void registerInsertedKey(EntityPersister persister, Serializable id);
|
||||
|
||||
/**
|
||||
* Allows callers to check to see if the identified entity was inserted during the current transaction.
|
||||
@ -712,13 +712,13 @@ public CollectionEntry addInitializedCollection(CollectionPersister persister,
|
||||
*
|
||||
* @return True if inserted during this transaction, false otherwise.
|
||||
*/
|
||||
public boolean wasInsertedDuringTransaction(EntityPersister persister, Serializable id);
|
||||
boolean wasInsertedDuringTransaction(EntityPersister persister, Serializable id);
|
||||
|
||||
/**
|
||||
* Provides centralized access to natural-id-related functionality.
|
||||
*/
|
||||
public static interface NaturalIdHelper {
|
||||
public static final Serializable INVALID_NATURAL_ID_REFERENCE = new Serializable() {};
|
||||
interface NaturalIdHelper {
|
||||
Serializable INVALID_NATURAL_ID_REFERENCE = new Serializable() {};
|
||||
|
||||
/**
|
||||
* Given an array of "full entity state", extract the portions that represent the natural id
|
||||
@ -728,7 +728,7 @@ public static interface NaturalIdHelper {
|
||||
*
|
||||
* @return The extracted natural id values
|
||||
*/
|
||||
public Object[] extractNaturalIdValues(Object[] state, EntityPersister persister);
|
||||
Object[] extractNaturalIdValues(Object[] state, EntityPersister persister);
|
||||
|
||||
/**
|
||||
* Given an entity instance, extract the values that represent the natural id
|
||||
@ -738,7 +738,7 @@ public static interface NaturalIdHelper {
|
||||
*
|
||||
* @return The extracted natural id values
|
||||
*/
|
||||
public Object[] extractNaturalIdValues(Object entity, EntityPersister persister);
|
||||
Object[] extractNaturalIdValues(Object entity, EntityPersister persister);
|
||||
|
||||
/**
|
||||
* Performs processing related to creating natural-id cross-reference entries on load.
|
||||
@ -748,9 +748,9 @@ public static interface NaturalIdHelper {
|
||||
* @param id The primary key value
|
||||
* @param naturalIdValues The natural id values
|
||||
*/
|
||||
public void cacheNaturalIdCrossReferenceFromLoad(
|
||||
EntityPersister persister,
|
||||
Serializable id,
|
||||
void cacheNaturalIdCrossReferenceFromLoad(
|
||||
EntityPersister persister,
|
||||
Serializable id,
|
||||
Object[] naturalIdValues);
|
||||
|
||||
/**
|
||||
@ -763,7 +763,7 @@ public void cacheNaturalIdCrossReferenceFromLoad(
|
||||
* Specifically represents the previous values on update, and so is only used with {@link CachedNaturalIdValueSource#UPDATE}
|
||||
* @param source Enumeration representing how these values are coming into cache.
|
||||
*/
|
||||
public void manageLocalNaturalIdCrossReference(
|
||||
void manageLocalNaturalIdCrossReference(
|
||||
EntityPersister persister,
|
||||
Serializable id,
|
||||
Object[] state,
|
||||
@ -779,7 +779,7 @@ public void manageLocalNaturalIdCrossReference(
|
||||
*
|
||||
* @return The local cached natural id values (could be different from given values).
|
||||
*/
|
||||
public Object[] removeLocalNaturalIdCrossReference(EntityPersister persister, Serializable id, Object[] state);
|
||||
Object[] removeLocalNaturalIdCrossReference(EntityPersister persister, Serializable id, Object[] state);
|
||||
|
||||
/**
|
||||
* Creates necessary shared (second level cache) cross-reference entries.
|
||||
@ -791,7 +791,7 @@ public void manageLocalNaturalIdCrossReference(
|
||||
* Specifically represents the previous values on update, and so is only used with {@link CachedNaturalIdValueSource#UPDATE}
|
||||
* @param source Enumeration representing how these values are coming into cache.
|
||||
*/
|
||||
public void manageSharedNaturalIdCrossReference(
|
||||
void manageSharedNaturalIdCrossReference(
|
||||
EntityPersister persister,
|
||||
Serializable id,
|
||||
Object[] state,
|
||||
@ -805,7 +805,7 @@ public void manageSharedNaturalIdCrossReference(
|
||||
* @param id The primary key value
|
||||
* @param naturalIdValues The natural id values array
|
||||
*/
|
||||
public void removeSharedNaturalIdCrossReference(EntityPersister persister, Serializable id, Object[] naturalIdValues);
|
||||
void removeSharedNaturalIdCrossReference(EntityPersister persister, Serializable id, Object[] naturalIdValues);
|
||||
|
||||
/**
|
||||
* Given a persister and primary key, find the corresponding cross-referenced natural id values.
|
||||
@ -815,7 +815,7 @@ public void manageSharedNaturalIdCrossReference(
|
||||
*
|
||||
* @return The cross-referenced natural-id values, or {@code null}
|
||||
*/
|
||||
public Object[] findCachedNaturalId(EntityPersister persister, Serializable pk);
|
||||
Object[] findCachedNaturalId(EntityPersister persister, Serializable pk);
|
||||
|
||||
/**
|
||||
* Given a persister and natural-id values, find the corresponding cross-referenced primary key. Will return
|
||||
@ -829,7 +829,7 @@ public void manageSharedNaturalIdCrossReference(
|
||||
* {@link PersistenceContext.NaturalIdHelper#INVALID_NATURAL_ID_REFERENCE},
|
||||
* or {@code null}.
|
||||
*/
|
||||
public Serializable findCachedNaturalIdResolution(EntityPersister persister, Object[] naturalIdValues);
|
||||
Serializable findCachedNaturalIdResolution(EntityPersister persister, Object[] naturalIdValues);
|
||||
|
||||
/**
|
||||
* Find all the locally cached primary key cross-reference entries for the given persister.
|
||||
@ -838,7 +838,7 @@ public void manageSharedNaturalIdCrossReference(
|
||||
*
|
||||
* @return The primary keys
|
||||
*/
|
||||
public Collection<Serializable> getCachedPkResolutions(EntityPersister persister);
|
||||
Collection<Serializable> getCachedPkResolutions(EntityPersister persister);
|
||||
|
||||
/**
|
||||
* Part of the "load synchronization process". Responsible for maintaining cross-reference entries
|
||||
@ -853,13 +853,13 @@ public void manageSharedNaturalIdCrossReference(
|
||||
*
|
||||
* @see #cleanupFromSynchronizations
|
||||
*/
|
||||
public void handleSynchronization(EntityPersister persister, Serializable pk, Object entity);
|
||||
void handleSynchronization(EntityPersister persister, Serializable pk, Object entity);
|
||||
|
||||
/**
|
||||
* The clean up process of {@link #handleSynchronization}. Responsible for cleaning up the tracking
|
||||
* of old values as no longer valid.
|
||||
*/
|
||||
public void cleanupFromSynchronizations();
|
||||
void cleanupFromSynchronizations();
|
||||
|
||||
/**
|
||||
* Called on {@link org.hibernate.Session#evict} to give a chance to clean up natural-id cross refs.
|
||||
@ -868,7 +868,7 @@ public void manageSharedNaturalIdCrossReference(
|
||||
* @param persister The entity persister
|
||||
* @param identifier The entity identifier
|
||||
*/
|
||||
public void handleEviction(Object object, EntityPersister persister, Serializable identifier);
|
||||
void handleEviction(Object object, EntityPersister persister, Serializable identifier);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -876,5 +876,5 @@ public void manageSharedNaturalIdCrossReference(
|
||||
*
|
||||
* @return This persistence context's natural-id helper
|
||||
*/
|
||||
public NaturalIdHelper getNaturalIdHelper();
|
||||
NaturalIdHelper getNaturalIdHelper();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user