Package org.hibernate.action.internal
Class AbstractEntityInsertAction
java.lang.Object
org.hibernate.action.internal.EntityAction
org.hibernate.action.internal.AbstractEntityInsertAction
- All Implemented Interfaces:
Serializable
,Comparable<ComparableExecutable>
,AfterTransactionCompletionProcess
,Executable
,ComparableExecutable
- Direct Known Subclasses:
EntityIdentityInsertAction
,EntityInsertAction
A base class for entity insert actions.
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractEntityInsertAction
(Object id, Object[] state, Object instance, boolean isVersionIncrementDisabled, EntityPersister persister, EventSource session) Constructs an AbstractEntityInsertAction object. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addCollectionsByKeyToPersistenceContext
(PersistenceContext persistenceContext, Object[] objects) void
afterDeserialize
(EventSource session) Reconnect to session after deserialization...Find the transient unsaved entity dependencies that are non-nullable.protected abstract EntityKey
Returns theEntityKey
.protected abstract Object
getRowId()
Object[]
getState()
Returns the entity state.void
handleNaturalIdPostSaveNotifications
(Object generatedId) Handle sending notifications needed for natural-id after savingprotected void
Handle sending notifications needed for natural-id before savingabstract boolean
Does this insert action need to be executed as soon as possible (e.g., to generate an ID)?final void
Make the entity "managed" by the persistence context.protected void
Indicate that the action has executed.protected final void
Nullifies any references to transient entities in the entity state maintained by this action.Methods inherited from class org.hibernate.action.internal.EntityAction
beforeExecutions, compareTo, eventSource, getAfterTransactionCompletionProcess, getBeforeTransactionCompletionProcess, getDelayedId, getEntityName, getFastSessionServices, getId, getInstance, getPersister, getPrimarySortClassifier, getPropertySpaces, getSecondarySortIndex, getSession, hasPostCommitEventListeners, isVeto, needsAfterTransactionCompletion, setVeto, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.hibernate.action.spi.AfterTransactionCompletionProcess
doAfterTransactionCompletion
Methods inherited from interface org.hibernate.action.spi.Executable
execute
-
Constructor Details
-
AbstractEntityInsertAction
protected AbstractEntityInsertAction(Object id, Object[] state, Object instance, boolean isVersionIncrementDisabled, EntityPersister persister, EventSource session) Constructs an AbstractEntityInsertAction object.- Parameters:
id
- - the entity IDstate
- - the entity stateinstance
- - the entityisVersionIncrementDisabled
- - true, if version increment should be disabled; false, otherwisepersister
- - the entity persistersession
- - the session
-
-
Method Details
-
getState
Returns the entity state.Note that the call to
nullifyTransientReferencesIfNotAlready()
can modify the entity state.- Returns:
- the entity state.
- See Also:
-
isEarlyInsert
public abstract boolean isEarlyInsert()Does this insert action need to be executed as soon as possible (e.g., to generate an ID)?- Returns:
- true, if it needs to be executed as soon as possible; false, otherwise.
-
findNonNullableTransientEntities
Find the transient unsaved entity dependencies that are non-nullable.- Returns:
- the transient unsaved entity dependencies that are non-nullable, or null if there are none.
-
nullifyTransientReferencesIfNotAlready
protected final void nullifyTransientReferencesIfNotAlready()Nullifies any references to transient entities in the entity state maintained by this action. References to transient entities should be nullified when an entity is made "managed" or when this action is executed, whichever is first.References will only be nullified the first time this method is called for a this object, so it can safely be called both when the entity is made "managed" and when this action is executed.
- See Also:
-
makeEntityManaged
public final void makeEntityManaged()Make the entity "managed" by the persistence context. -
addCollectionsByKeyToPersistenceContext
protected void addCollectionsByKeyToPersistenceContext(PersistenceContext persistenceContext, Object[] objects) -
markExecuted
protected void markExecuted()Indicate that the action has executed. -
getEntityKey
Returns theEntityKey
.- Returns:
- the
EntityKey
.
-
getRowId
-
afterDeserialize
Description copied from class:EntityAction
Reconnect to session after deserialization...- Specified by:
afterDeserialize
in interfaceExecutable
- Overrides:
afterDeserialize
in classEntityAction
- Parameters:
session
- The session being deserialized
-
handleNaturalIdPreSaveNotifications
protected void handleNaturalIdPreSaveNotifications()Handle sending notifications needed for natural-id before saving -
handleNaturalIdPostSaveNotifications
Handle sending notifications needed for natural-id after saving- Parameters:
generatedId
- The generated entity identifier
-