Top Description Fields Constructors Methods
org.hibernate.action.internal

public abstract Class AbstractEntityInsertAction

extends EntityAction
Class Inheritance
Known Direct Subclasses
org.hibernate.action.internal.EntityIdentityInsertAction, org.hibernate.action.internal.EntityInsertAction
Imports
java.io.Serializable, org.hibernate.LockMode, org.hibernate.engine.internal.ForeignKeys, .NonNullableTransientDependencies, .Nullability, .Versioning, org.hibernate.engine.spi.CachedNaturalIdValueSource, .EntityEntry, .EntityKey, .PersistenceContext, .SharedSessionContractImplementor, .Status, org.hibernate.persister.entity.EntityPersister

A base class for entity insert actions.
Author
Gail Badner

Field Summary

Modifier and TypeField and Description
private boolean
private boolean
private final boolean
private transient Object[]

Constructor Summary

AccessConstructor and Description
protected
AbstractEntityInsertAction(Serializable
- the entity ID
id
,
Object[]
- the entity state
state
,
Object
- the entity
instance
,
boolean
- true, if version increment should be disabled; false, otherwise
isVersionIncrementDisabled
,
EntityPersister
- the entity persister
persister
,
SharedSessionContractImplementor
- the session
session
)

Constructs an AbstractEntityInsertAction object.

Method Summary

Modifier and TypeMethod and Description
public void
afterDeserialize(SharedSessionContractImplementor
The session being deserialized
session
)

Overrides org.hibernate.action.internal.EntityAction.afterDeserialize.

Implements org.hibernate.action.spi.Executable.afterDeserialize.

Reconnect to session after deserialization...
public NonNullableTransientDependencies

Returns:

the transient unsaved entity dependencies that are non-nullable, or null if there are none.
findNonNullableTransientEntities
()

Find the transient unsaved entity dependencies that are non-nullable.

protected abstract EntityKey

Returns:

the EntityKey.
getEntityKey
()

Returns the EntityKey.

public Object[]

Returns:

the entity state.
getState
()

Returns the entity state.

public void
handleNaturalIdPostSaveNotifications(Serializable
The generated entity identifier
generatedId
)

Handle sending notifications needed for natural-id after saving

protected void
handleNaturalIdPreSaveNotifications()

Handle sending notifications needed for natural-id before saving

public abstract boolean

Returns:

true, if it needs to be executed as soon as possible; false, otherwise.
isEarlyInsert
()

Does this insert action need to be executed as soon as possible (e.g., to generate an ID)?

public final void
makeEntityManaged()

Make the entity "managed" by the persistence context.

protected void
markExecuted()

Indicate that the action has executed.

protected final void
nullifyTransientReferencesIfNotAlready()

Nullifies any references to transient entities in the entity state maintained by this action.

Inherited from org.hibernate.action.internal.EntityAction:
beforeExecutionscompareToeventSourcegetAfterTransactionCompletionProcessgetBeforeTransactionCompletionProcessgetDelayedIdgetEntityNamegetFastSessionServicesgetIdgetInstancegetPersistergetPropertySpacesgetSessionhasPostCommitEventListenersisVetolistenerGroupneedsAfterTransactionCompletionsetVetotoString

Field Detail

areTransientReferencesNullifiedback to summary
private boolean areTransientReferencesNullified
isExecutedback to summary
private boolean isExecuted
isVersionIncrementDisabledback to summary
private final boolean isVersionIncrementDisabled
stateback to summary
private transient Object[] state

Constructor Detail

AbstractEntityInsertActionback to summary
protected AbstractEntityInsertAction(Serializable id, Object[] state, Object instance, boolean isVersionIncrementDisabled, EntityPersister persister, SharedSessionContractImplementor session)

Constructs an AbstractEntityInsertAction object.

Parameters
id:Serializable

- the entity ID

state:Object[]

- the entity state

instance:Object

- the entity

isVersionIncrementDisabled:boolean

- true, if version increment should be disabled; false, otherwise

persister:EntityPersister

- the entity persister

session:SharedSessionContractImplementor

- the session

Method Detail

afterDeserializeback to summary
public void afterDeserialize(SharedSessionContractImplementor session)

Overrides org.hibernate.action.internal.EntityAction.afterDeserialize.

Implements org.hibernate.action.spi.Executable.afterDeserialize.

Doc from org.hibernate.action.internal.EntityAction.afterDeserialize.

Reconnect to session after deserialization...

Parameters
session:SharedSessionContractImplementor

The session being deserialized

Annotations
@Override
findNonNullableTransientEntitiesback to summary
public NonNullableTransientDependencies findNonNullableTransientEntities()

Find the transient unsaved entity dependencies that are non-nullable.

Returns:NonNullableTransientDependencies

the transient unsaved entity dependencies that are non-nullable, or null if there are none.

getEntityKeyback to summary
protected abstract EntityKey getEntityKey()

Returns the EntityKey.

Returns:EntityKey

the EntityKey.

getStateback to summary
public Object[] getState()

Returns the entity state.

Note

calling nullifyTransientReferencesIfNotAlready can modify the entity state.

Returns:Object[]

the entity state.

See Also
nullifyTransientReferencesIfNotAlready
handleNaturalIdPostSaveNotificationsback to summary
public void handleNaturalIdPostSaveNotifications(Serializable generatedId)

Handle sending notifications needed for natural-id after saving

Parameters
generatedId:Serializable

The generated entity identifier

handleNaturalIdPreSaveNotificationsback to summary
protected void handleNaturalIdPreSaveNotifications()

Handle sending notifications needed for natural-id before saving

isEarlyInsertback to summary
public abstract boolean isEarlyInsert()

Does this insert action need to be executed as soon as possible (e.g., to generate an ID)?

Returns:boolean

true, if it needs to be executed as soon as possible; false, otherwise.

makeEntityManagedback to summary
public final void makeEntityManaged()

Make the entity "managed" by the persistence context.

markExecutedback to summary
protected void markExecuted()

Indicate that the action has executed.

nullifyTransientReferencesIfNotAlreadyback to summary
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()