Class OneToOneType

    • Constructor Detail

      • OneToOneType

        public OneToOneType​(TypeConfiguration typeConfiguration,
                            String referencedEntityName,
                            ForeignKeyDirection foreignKeyType,
                            boolean referenceToPrimaryKey,
                            String uniqueKeyPropertyName,
                            boolean lazy,
                            boolean unwrapProxy,
                            String entityName,
                            String propertyName,
                            boolean constrained)
      • OneToOneType

        public OneToOneType​(OneToOneType original,
                            String superTypeEntityName)
    • Method Detail

      • getColumnSpan

        public int getColumnSpan​(Mapping session)
                          throws MappingException
        Description copied from interface: Type
        How many columns are used to persist this type?

        Always the same as getSqlTypCodes(mapping).length.

        Parameters:
        session - The mapping object :/
        Returns:
        The number of columns
        Throws:
        MappingException - Generally indicates an issue accessing the passed mapping object.
      • toColumnNullness

        public boolean[] toColumnNullness​(Object value,
                                          Mapping mapping)
        Description copied from interface: Type
        Given an instance of the type, return an array of boolean values indicating which mapped columns would be null.
        Parameters:
        value - an instance of the type
        mapping - The mapping abstraction
        Returns:
        array indicating column nullness for a value instance
      • nullSafeSet

        public void nullSafeSet​(PreparedStatement st,
                                Object value,
                                int index,
                                boolean[] settable,
                                SharedSessionContractImplementor session)
        Description copied from interface: Type
        Bind a value represented by an instance of the mapped class to the given JDBC PreparedStatement, ignoring some columns as dictated by the settable parameter. Implementors should handle the possibility of null values. A multi-column type should bind parameters starting from index.
        Specified by:
        nullSafeSet in interface Type
        Overrides:
        nullSafeSet in class EntityType
        Parameters:
        st - The JDBC prepared statement to which to bind
        value - the object to write
        index - starting parameter bind index
        settable - an array indicating which columns to bind/ignore
        session - The originating session
      • isOneToOne

        public boolean isOneToOne()
        Description copied from class: EntityType
        Is the association modeled here defined as a 1-1 in the database (physical model)?
        Specified by:
        isOneToOne in class EntityType
        Returns:
        True if a 1-1 in the database; false otherwise.
      • isDirty

        public boolean isDirty​(Object old,
                               Object current,
                               SharedSessionContractImplementor session)
        Description copied from interface: Type
        Should the parent be considered dirty, given both the old and current value?
        Specified by:
        isDirty in interface Type
        Overrides:
        isDirty in class AbstractType
        Parameters:
        old - the old value
        current - the current value
        session - The session from which the request originated.
        Returns:
        true if the field is dirty
      • isDirty

        public boolean isDirty​(Object old,
                               Object current,
                               boolean[] checkable,
                               SharedSessionContractImplementor session)
        Description copied from interface: Type
        Should the parent be considered dirty, given both the old and current value?
        Parameters:
        old - the old value
        current - the current value
        checkable - An array of booleans indicating which columns making up the value are actually checkable
        session - The session from which the request originated.
        Returns:
        true if the field is dirty
      • getForeignKeyDirection

        public ForeignKeyDirection getForeignKeyDirection()
        Description copied from interface: AssociationType
        Get the foreign key directionality of this association
      • isNullable

        public boolean isNullable()
        Description copied from class: EntityType
        The nullability of the property.
        Specified by:
        isNullable in class EntityType
        Returns:
        The nullability of the property.
      • useLHSPrimaryKey

        public boolean useLHSPrimaryKey()
        Description copied from interface: AssociationType
        Is the primary key of the owning entity table to be used in the join?
      • disassemble

        public Serializable disassemble​(Object value,
                                        SharedSessionContractImplementor session,
                                        Object owner)
                                 throws HibernateException
        Description copied from interface: Type
        Return a disassembled representation of the object. This is the representation that is stored in the second-level cache.

        A reference to an associated entity should be disassembled to its primary key value.

        Specified by:
        disassemble in interface Type
        Overrides:
        disassemble in class AbstractType
        Parameters:
        value - the value to cache
        session - the originating session
        owner - optional parent entity object (needed for collections)
        Returns:
        the disassembled, deep cloned state
        Throws:
        HibernateException - An error from Hibernate
      • isAlwaysDirtyChecked

        public boolean isAlwaysDirtyChecked()
        We don't need to dirty check one-to-one because of how assemble/disassemble is implemented and because a one-to-one association is never dirty