Interface EntityIdentifierMapping

    • Method Detail

      • getUnsavedStrategy

        IdentifierValue getUnsavedStrategy()
        The strategy for distinguishing between detached and transient state based on the identifier mapping
      • getIdentifierIfNotUnsaved

        default Object getIdentifierIfNotUnsaved​(Object entity,
                                                 SharedSessionContractImplementor 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. This does a "best guess" using any/all info available to use (not just the EntityEntry).

        Parameters:
        entity - The entity instance
        session - The session
        Returns:
        The identifier
        Throws:
        TransientObjectException - if the entity is transient (does not yet have an identifier)
        Since:
        6.1.1
        See Also:
        ForeignKeys.getEntityIdentifierIfNotUnsaved(String, Object, SharedSessionContractImplementor)
      • instantiate

        Object instantiate()