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 boolean
cacheAfterInsert(EntityDataAccess cache, Object ck)
protected boolean
cacheInsert(EntityPersister persister, Object ck)
void
doAfterTransactionCompletion(boolean success, SharedSessionContractImplementor session)
Perform whatever processing is encapsulated here after completion of the transaction.void
execute()
Execute this action.protected Object
getCacheEntry()
protected EntityKey
getEntityKey()
Returns theEntityKey
.protected Object
getRowId()
Object
getVersion()
protected boolean
hasPostCommitEventListeners()
protected boolean
isCachePutEnabled(EntityPersister persister, SharedSessionContractImplementor session)
boolean
isEarlyInsert()
Does this insert action need to be executed as soon as possible (e.g., to generate an ID)?protected void
postCommitInsert(boolean success)
protected void
postInsert()
protected boolean
preInsert()
protected void
putCacheIfNecessary()
protected void
setCacheEntry(Object cacheEntry)
void
setVersion(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:AbstractEntityInsertAction
Does this insert action need to be executed as soon as possible (e.g., to generate an ID)?- Specified by:
isEarlyInsert
in classAbstractEntityInsertAction
- Returns:
- true, if it needs to be executed as soon as possible; false, otherwise.
-
getRowId
protected Object getRowId()
- Specified by:
getRowId
in classAbstractEntityInsertAction
-
getEntityKey
protected EntityKey getEntityKey()
Description copied from class:AbstractEntityInsertAction
Returns theEntityKey
.- Specified by:
getEntityKey
in classAbstractEntityInsertAction
- Returns:
- the
EntityKey
.
-
execute
public void execute() throws HibernateException
Description copied from interface:Executable
Execute 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 HibernateException
Description copied from interface:AfterTransactionCompletionProcess
Perform 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:
hasPostCommitEventListeners
in classEntityAction
-
isCachePutEnabled
protected boolean isCachePutEnabled(EntityPersister persister, SharedSessionContractImplementor session)
-
-