org.hibernate.engine
Class ForeignKeys

java.lang.Object
  extended by org.hibernate.engine.ForeignKeys

public final class ForeignKeys
extends Object

Algorithms related to foreign key constraint transparency

Author:
Gavin King

Nested Class Summary
static class ForeignKeys.Nullifier
           
 
Method Summary
static 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 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 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isNotTransient

public static boolean isNotTransient(String entityName,
                                     Object entity,
                                     Boolean assumed,
                                     SessionImplementor session)
                              throws HibernateException
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.

Throws:
HibernateException

isTransient

public static boolean isTransient(String entityName,
                                  Object entity,
                                  Boolean assumed,
                                  SessionImplementor session)
                           throws HibernateException
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.

Throws:
HibernateException

getEntityIdentifierIfNotUnsaved

public static Serializable getEntityIdentifierIfNotUnsaved(String entityName,
                                                           Object object,
                                                           SessionImplementor session)
                                                    throws HibernateException
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).

Throws:
HibernateException