org.hibernate.action.internal
Class AbstractEntityInsertAction

java.lang.Object
  extended by org.hibernate.action.internal.EntityAction
      extended by org.hibernate.action.internal.AbstractEntityInsertAction
All Implemented Interfaces:
Serializable, Comparable, AfterTransactionCompletionProcess, Executable
Direct Known Subclasses:
EntityIdentityInsertAction, EntityInsertAction

public abstract class AbstractEntityInsertAction
extends EntityAction

A base class for entity insert actions.

See Also:
Serialized Form

Constructor Summary
protected AbstractEntityInsertAction(Serializable id, Object[] state, Object instance, boolean isVersionIncrementDisabled, EntityPersister persister, SessionImplementor session)
          Constructs an AbstractEntityInsertAction object.
 
Method Summary
 void afterDeserialize(SessionImplementor session)
          Reconnect to session after deserialization...
 NonNullableTransientDependencies findNonNullableTransientEntities()
          Find the transient unsaved entity dependencies that are non-nullable.
protected abstract  EntityKey getEntityKey()
          Returns the EntityKey.
 Object[] getState()
          Returns the entity state.
protected  void handleNaturalIdPostSaveNotifications()
          Handle sending notifications needed for natural-id after saving
protected  void handleNaturalIdPreSaveNotifications()
          Handle sending notifications needed for natural-id before saving
abstract  boolean isEarlyInsert()
          Does this insert action need to be executed as soon as possible (e.g., to generate an ID)?
 void makeEntityManaged()
          Make the entity "managed" by the persistence context.
protected  void markExecuted()
          Indicate that the action has executed.
protected  void nullifyTransientReferencesIfNotAlready()
          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, getId, getInstance, getPersister, getPropertySpaces, getSession, hasPostCommitEventListeners, listenerGroup, needsAfterTransactionCompletion, 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.Executable
execute
 
Methods inherited from interface org.hibernate.action.spi.AfterTransactionCompletionProcess
doAfterTransactionCompletion
 

Constructor Detail

AbstractEntityInsertAction

protected AbstractEntityInsertAction(Serializable id,
                                     Object[] state,
                                     Object instance,
                                     boolean isVersionIncrementDisabled,
                                     EntityPersister persister,
                                     SessionImplementor session)
Constructs an AbstractEntityInsertAction object.

Parameters:
id - - the entity ID
state - - the entity state
instance - - the entity
isVersionIncrementDisabled - - true, if version increment should be disabled; false, otherwise
persister - - the entity persister
session - - the session
Method Detail

getState

public Object[] getState()
Returns the entity state. NOTE: calling nullifyTransientReferencesIfNotAlready() can modify the entity state.

Returns:
the entity state.
See Also:
#nullifyTransientReferencesIfNotAlready}

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

public NonNullableTransientDependencies 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() }

makeEntityManaged

public final void makeEntityManaged()
Make the entity "managed" by the persistence context.


markExecuted

protected void markExecuted()
Indicate that the action has executed.


getEntityKey

protected abstract EntityKey getEntityKey()
Returns the EntityKey.

Returns:
the EntityKey.

afterDeserialize

public void afterDeserialize(SessionImplementor session)
Description copied from class: EntityAction
Reconnect to session after deserialization...

Overrides:
afterDeserialize in class EntityAction
Parameters:
session - The session being deserialized

handleNaturalIdPreSaveNotifications

protected void handleNaturalIdPreSaveNotifications()
Handle sending notifications needed for natural-id before saving


handleNaturalIdPostSaveNotifications

protected void handleNaturalIdPostSaveNotifications()
Handle sending notifications needed for natural-id after saving



Copyright © 2001-2012 Red Hat, Inc. All Rights Reserved.