Interface EntityIdentifierMapping

    • Method Detail

      • matchesRoleName

        static boolean matchesRoleName​(String name)
      • getPartName

        default String getPartName()
        Description copied from interface: ModelPart
        The local part name, which is generally the unqualified role name
        Specified by:
        getPartName in interface ModelPart
      • getAttributeName

        String getAttributeName()
        The name of the attribute defining the id, if one
      • instantiate

        Object instantiate()
        Instantiate an instance of the identifier.
        API Note:
        This is really only valid on composite identifiers
      • getIdentifier

        Object getIdentifier​(Object entity)
        Extract the identifier from an instance of the entity
      • 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)