Package org.hibernate.action.internal
Class UnresolvedEntityInsertActions
- java.lang.Object
-
- org.hibernate.action.internal.UnresolvedEntityInsertActions
-
public class UnresolvedEntityInsertActions extends Object
Tracks unresolved entity insert actions.An entity insert action is unresolved if the entity to be inserted has at least one non-nullable association with an unsaved transient entity, and the foreign key points to that unsaved transient entity.
These references must be resolved before an insert action can be executed.
-
-
Constructor Summary
Constructors Constructor Description UnresolvedEntityInsertActions()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addUnresolvedEntityInsertAction(AbstractEntityInsertAction insert, NonNullableTransientDependencies dependencies)
Add an unresolved insert action.void
checkNoUnresolvedActionsAfterOperation()
ThrowsPropertyValueException
if there are any unresolved entity insert actions that depend on non-nullable associations with a transient entity.void
clear()
Clear thisUnresolvedEntityInsertActions
.static UnresolvedEntityInsertActions
deserialize(ObjectInputStream ois, EventSource session)
Deserialize anUnresolvedEntityInsertActions
object.Iterable<AbstractEntityInsertAction>
getDependentEntityInsertActions()
Returns the unresolved insert actions.boolean
isEmpty()
Returns true if there are no unresolved entity insert actions.Set<AbstractEntityInsertAction>
resolveDependentActions(Object managedEntity, SessionImplementor session)
Resolve any dependencies onmanagedEntity
.void
serialize(ObjectOutputStream oos)
Serialize thisUnresolvedEntityInsertActions
object.String
toString()
-
-
-
Method Detail
-
addUnresolvedEntityInsertAction
public void addUnresolvedEntityInsertAction(AbstractEntityInsertAction insert, NonNullableTransientDependencies dependencies)
Add an unresolved insert action.- Parameters:
insert
- - unresolved insert action.dependencies
- - non-nullable transient dependencies (must be non-null and non-empty).- Throws:
IllegalArgumentException
- ifdependencies is null or empty
.
-
getDependentEntityInsertActions
public Iterable<AbstractEntityInsertAction> getDependentEntityInsertActions()
Returns the unresolved insert actions.- Returns:
- the unresolved insert actions.
-
checkNoUnresolvedActionsAfterOperation
public void checkNoUnresolvedActionsAfterOperation() throws PropertyValueException
ThrowsPropertyValueException
if there are any unresolved entity insert actions that depend on non-nullable associations with a transient entity. This method should be called on completion of an operation (after all cascades are completed) that saves an entity.- Throws:
PropertyValueException
- if there are any unresolved entity insert actions;PropertyValueException.getEntityName()
andPropertyValueException.getPropertyName()
will return the entity name and property value for the first unresolved entity insert action.
-
isEmpty
public boolean isEmpty()
Returns true if there are no unresolved entity insert actions.- Returns:
- true, if there are no unresolved entity insert actions; false, otherwise.
-
resolveDependentActions
public Set<AbstractEntityInsertAction> resolveDependentActions(Object managedEntity, SessionImplementor session)
Resolve any dependencies onmanagedEntity
.- Parameters:
managedEntity
- - the managed entity namesession
- - the session- Returns:
- the insert actions that depended only on the specified entity.
- Throws:
IllegalArgumentException
- ifmanagedEntity
did not have managed or read-only status.
-
clear
public void clear()
Clear thisUnresolvedEntityInsertActions
.
-
serialize
public void serialize(ObjectOutputStream oos) throws IOException
Serialize thisUnresolvedEntityInsertActions
object.- Parameters:
oos
- - the output stream- Throws:
IOException
- if there is an error writing this object to the output stream.
-
deserialize
public static UnresolvedEntityInsertActions deserialize(ObjectInputStream ois, EventSource session) throws IOException, ClassNotFoundException
Deserialize anUnresolvedEntityInsertActions
object.- Parameters:
ois
- - the input stream.session
- - the session.- Returns:
- the deserialized
UnresolvedEntityInsertActions
object - Throws:
IOException
- if there is an error writing this object to the output stream.ClassNotFoundException
- if there is a class that cannot be loaded.
-
-