public final class ForeignKeys extends Object
Modifier and Type | Class and Description |
---|---|
static class | ForeignKeys.Nullifier Delegate for handling nullifying ("null"ing-out) non-cascaded associations |
Modifier and Type | Method and Description |
---|---|
static CompletionStage<Serializable> | getEntityIdentifierIfNotUnsaved(String entityName, Object object, SessionImplementor 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. |
static CompletionStage<Boolean> | isNotTransient(String entityName, Object entity, Boolean assumed, SessionImplementor session) Is this instance persistent or detached? If assumed is non-null, don't hit the database to make the determination, instead assume that value; the client code must be prepared to "recover" in the case that this assumed result is incorrect. |
static CompletionStage<Boolean> | isTransient(String entityName, Object entity, Boolean assumed, SessionImplementor session) Is this instance, which we know is not persistent, actually transient? If assumed is non-null, don't hit the database to make the determination, instead assume that value; the client code must be prepared to "recover" in the case that this assumed result is incorrect. |
public static CompletionStage<Boolean> isNotTransient(String entityName, Object entity, Boolean assumed, SessionImplementor session)
entityName
- The name of the entityentity
- The entity instanceassumed
- The assumed return value, if avoiding database hit is desiredsession
- The sessiontrue
if the given entity is not transient (meaning it is either detached/persistent)public static CompletionStage<Boolean> isTransient(String entityName, Object entity, Boolean assumed, SessionImplementor session)
entityName
- The name of the entityentity
- The entity instanceassumed
- The assumed return value, if avoiding database hit is desiredsession
- The sessiontrue
if the given entity is transient (unsaved)public static CompletionStage<Serializable> getEntityIdentifierIfNotUnsaved(String entityName, Object object, SessionImplementor session) throws TransientObjectException
entityName
- The name of the entityobject
- The entity instancesession
- The sessionTransientObjectException
- if the entity is transient (does not yet have an identifier)