Package org.hibernate.action.internal
Class EntityInsertAction
- java.lang.Object
-
- org.hibernate.action.internal.EntityAction
-
- org.hibernate.action.internal.AbstractEntityInsertAction
-
- org.hibernate.action.internal.EntityInsertAction
-
- All Implemented Interfaces:
Serializable,Comparable<ComparableExecutable>,AfterTransactionCompletionProcess,Executable,ComparableExecutable
public class EntityInsertAction extends AbstractEntityInsertAction
The action for performing an entity insertion, for entities not defined to use IDENTITY generation.- See Also:
EntityIdentityInsertAction, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description EntityInsertAction(Object id, Object[] state, Object instance, Object version, EntityPersister persister, boolean isVersionIncrementDisabled, EventSource session)Constructs an EntityInsertAction.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancacheAfterInsert(EntityDataAccess cache, Object ck)protected booleancacheInsert(EntityPersister persister, Object ck)voiddoAfterTransactionCompletion(boolean success, SharedSessionContractImplementor session)Perform whatever processing is encapsulated here after completion of the transaction.voidexecute()Execute this action.protected ObjectgetCacheEntry()protected EntityKeygetEntityKey()Returns theEntityKey.ObjectgetVersion()protected booleanhasPostCommitEventListeners()protected booleanisCachePutEnabled(EntityPersister persister, SharedSessionContractImplementor session)booleanisEarlyInsert()Does this insert action need to be executed as soon as possible (e.g., to generate an ID)?protected voidpostCommitInsert(boolean success)protected voidpostInsert()protected booleanpreInsert()protected voidputCacheIfNecessary()protected voidsetCacheEntry(Object cacheEntry)voidsetVersion(Object version)-
Methods inherited from class org.hibernate.action.internal.AbstractEntityInsertAction
addCollectionsByKeyToPersistenceContext, afterDeserialize, findNonNullableTransientEntities, getState, handleNaturalIdPostSaveNotifications, handleNaturalIdPreSaveNotifications, makeEntityManaged, markExecuted, nullifyTransientReferencesIfNotAlready
-
Methods inherited from class org.hibernate.action.internal.EntityAction
beforeExecutions, compareTo, eventSource, getAfterTransactionCompletionProcess, getBeforeTransactionCompletionProcess, getDelayedId, getEntityName, getFastSessionServices, getId, getInstance, getPersister, getPrimarySortClassifier, getPropertySpaces, getSecondarySortIndex, getSession, isVeto, needsAfterTransactionCompletion, setVeto, toString
-
-
-
-
Constructor Detail
-
EntityInsertAction
public EntityInsertAction(Object id, Object[] state, Object instance, Object version, EntityPersister persister, boolean isVersionIncrementDisabled, EventSource session)
Constructs an EntityInsertAction.- Parameters:
id- The entity identifierstate- The current (extracted) entity stateinstance- The entity instanceversion- The current entity version valuepersister- The entity's persisterisVersionIncrementDisabled- Whether version incrementing is disabled.session- The session
-
-
Method Detail
-
getVersion
public Object getVersion()
-
setVersion
public void setVersion(Object version)
-
getCacheEntry
protected Object getCacheEntry()
-
setCacheEntry
protected void setCacheEntry(Object cacheEntry)
-
isEarlyInsert
public boolean isEarlyInsert()
Description copied from class:AbstractEntityInsertActionDoes this insert action need to be executed as soon as possible (e.g., to generate an ID)?- Specified by:
isEarlyInsertin classAbstractEntityInsertAction- Returns:
- true, if it needs to be executed as soon as possible; false, otherwise.
-
getEntityKey
protected EntityKey getEntityKey()
Description copied from class:AbstractEntityInsertActionReturns theEntityKey.- Specified by:
getEntityKeyin classAbstractEntityInsertAction- Returns:
- the
EntityKey.
-
execute
public void execute() throws HibernateExceptionDescription copied from interface:ExecutableExecute this action.- Throws:
HibernateException- Indicates a problem during execution.
-
putCacheIfNecessary
protected void putCacheIfNecessary()
-
cacheInsert
protected boolean cacheInsert(EntityPersister persister, Object ck)
-
postInsert
protected void postInsert()
-
postCommitInsert
protected void postCommitInsert(boolean success)
-
preInsert
protected boolean preInsert()
-
doAfterTransactionCompletion
public void doAfterTransactionCompletion(boolean success, SharedSessionContractImplementor session) throws HibernateExceptionDescription copied from interface:AfterTransactionCompletionProcessPerform whatever processing is encapsulated here after completion of the transaction.- Parameters:
success- Did the transaction complete successfully? True means it did.session- The session on which the transaction is completing.- Throws:
HibernateException
-
cacheAfterInsert
protected boolean cacheAfterInsert(EntityDataAccess cache, Object ck)
-
hasPostCommitEventListeners
protected boolean hasPostCommitEventListeners()
- Specified by:
hasPostCommitEventListenersin classEntityAction
-
isCachePutEnabled
protected boolean isCachePutEnabled(EntityPersister persister, SharedSessionContractImplementor session)
-
-