| Modifier and Type | Class and Description |
|---|---|
| public static class | ForeignKeys.Nullifier
Delegate for handling nullifying ("null"ing-out) non-cascaded associations |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private static void | collectNonNullableTransientEntities(ForeignKeys.
|
| public static NonNullableTransientDependencies | Returns: the transient unsaved entity dependencies that are non-nullable, or null if there are none.- the entity name entityName, Object - the entity instance entity, Object[] - insertable properties of the object (including backrefs),
possibly with substitutions values, boolean - true if the entity needs to be executed as soon as possible
(e.g., to generate an ID) isEarlyInsert, SharedSessionContractImplementor - the session session)Find all non-nullable references to entities that have not yet been inserted in the database, where the foreign key is a reference to an unsaved transient entity. |
| public static Object | Returns: The identifierThe name of the entity entityName, final Object The entity instance object, final SharedSessionContractImplementor The session session)Return the identifier of the persistent or transient object, or throw an exception if the instance is "unsaved" Used by OneToOneType and ManyToOneType to determine what id value should be used for an object that may or may not be associated with the session. |
| public static boolean | Returns: true if the given entity is not transient (meaning it is either detached/persistent)The name of the entity entityName, Object The entity instance entity, Boolean The assumed return value, if avoiding database hit is desired assumed, SharedSessionContractImplementor The session session)Is this instance persistent or detached? |
| public static boolean | Returns: true if the given entity is transient (unsaved)The name of the entity entityName, Object The entity instance entity, Boolean The assumed return value, if avoiding database hit is desired assumed, SharedSessionContractImplementor The session session)Is this instance, which we know is not persistent, actually transient? |
| ForeignKeys | back to summary |
|---|---|
| private ForeignKeys() Disallow instantiation | |
| collectNonNullableTransientEntities | back to summary |
|---|---|
| private static void collectNonNullableTransientEntities(ForeignKeys. | |
| findNonNullableTransientEntities | back to summary |
|---|---|
| public static NonNullableTransientDependencies findNonNullableTransientEntities(String entityName, Object entity, Object[] values, boolean isEarlyInsert, SharedSessionContractImplementor session) Find all non-nullable references to entities that have not yet been inserted in the database, where the foreign key is a reference to an unsaved transient entity. .
| |
| getEntityIdentifierIfNotUnsaved | back to summary |
|---|---|
| public static Object getEntityIdentifierIfNotUnsaved(final String entityName, final Object object, final SharedSessionContractImplementor session) throws TransientObjectException Return the identifier of the persistent or transient object, or throw an exception if the instance is "unsaved" Used by OneToOneType and ManyToOneType to determine what id value should be used for an object that may or may not be associated with the session. This does a "best guess" using any/all info available to use (not just the EntityEntry).
| |
| isNotTransient | back to summary |
|---|---|
| public static boolean isNotTransient(String entityName, Object entity, Boolean assumed, SharedSessionContractImplementor session) Is this instance persistent or detached?
If
| |
| isTransient | back to summary |
|---|---|
| public static boolean isTransient(String entityName, Object entity, Boolean assumed, SharedSessionContractImplementor session) Is this instance, which we know is not persistent, actually transient?
If
| |
| Modifier and Type | Field and Description |
|---|---|
| private final boolean | |
| private final boolean | |
| private final EntityPersister | |
| private final Object | |
| private final SharedSessionContractImplementor |
| Access | Constructor and Description |
|---|---|
| public | Nullifier(final Object
The entity self, final boolean Are we in the middle of a delete action? isDelete, final boolean Is this an early insert (INSERT generated id strategy)? isEarlyInsert, final SharedSessionContractImplementor The session session, final EntityPersister The EntityPersister for persister)selfConstructs a Nullifier |
| Modifier and Type | Method and Description |
|---|---|
| private Object | |
| private boolean | isNullifiable(final String
The name of the entity entityName, Object The entity instance object)Determine if the object already exists in the database, using a "best guess" |
| public void | nullifyTransientReferences(final Object[]
The entity attribute values values)Nullify all references to entities that have not yet been inserted in the database, where the foreign key points toward that entity. |
| private Object | Returns: null if the argument is an unsaved entity; otherwise return the argument.An entity attribute value value, final String An entity attribute name propertyName, final Type An entity attribute type type)Return null if the argument is an "unsaved" entity (ie. |
| isDelete | back to summary |
|---|---|
| private final boolean isDelete | |
| isEarlyInsert | back to summary |
|---|---|
| private final boolean isEarlyInsert | |
| persister | back to summary |
|---|---|
| private final EntityPersister persister | |
| self | back to summary |
|---|---|
| private final Object self | |
| session | back to summary |
|---|---|
| private final SharedSessionContractImplementor session | |
| Nullifier | back to summary |
|---|---|
| public Nullifier(final Object self, final boolean isDelete, final boolean isEarlyInsert, final SharedSessionContractImplementor session, final EntityPersister persister) Constructs a Nullifier
| |
| initializeIfNecessary | back to summary |
|---|---|
| private Object initializeIfNecessary(final Object value, final String propertyName, final Type type) | |
| isNullifiable | back to summary |
|---|---|
| private boolean isNullifiable(final String entityName, Object object) throws HibernateException Determine if the object already exists in the database, using a "best guess" | |
| nullifyTransientReferences | back to summary |
|---|---|
| public void nullifyTransientReferences(final Object[] values) Nullify all references to entities that have not yet been inserted in the database, where the foreign key points toward that entity.
| |
| nullifyTransientReferences | back to summary |
|---|---|
| private Object nullifyTransientReferences(final Object value, final String propertyName, final Type type) Return null if the argument is an "unsaved" entity (ie. one with no existing database row), or the input argument otherwise. This is how Hibernate avoids foreign key constraint violations. | |