类 EntityType

    • 字段详细资料

      • uniqueKeyPropertyName

        protected final String uniqueKeyPropertyName
    • 构造器详细资料

      • EntityType

        @Deprecated
        protected EntityType​(TypeFactory.TypeScope scope,
                             String entityName,
                             String uniqueKeyPropertyName,
                             boolean eager,
                             boolean unwrapProxy)
        Constructs the requested entity type mapping.
        参数:
        scope - The type scope
        entityName - The name of the associated entity.
        uniqueKeyPropertyName - The property-ref name, or null if we reference the PK of the associated entity.
        eager - Is eager fetching enabled.
        unwrapProxy - Is unwrapping of proxies allowed for this association; unwrapping says to return the "implementation target" of lazy proxies; typically only possible with lazy="no-proxy".
      • EntityType

        protected EntityType​(TypeFactory.TypeScope scope,
                             String entityName,
                             boolean referenceToPrimaryKey,
                             String uniqueKeyPropertyName,
                             boolean eager,
                             boolean unwrapProxy)
        Constructs the requested entity type mapping.
        参数:
        scope - The type scope
        entityName - The name of the associated entity.
        referenceToPrimaryKey - True if association references a primary key.
        uniqueKeyPropertyName - The property-ref name, or null if we reference the PK of the associated entity.
        eager - Is eager fetching enabled.
        unwrapProxy - Is unwrapping of proxies allowed for this association; unwrapping says to return the "implementation target" of lazy proxies; typically only possible with lazy="no-proxy".
      • EntityType

        protected EntityType​(EntityType original,
                             String superTypeEntityName)
    • 方法详细资料

      • isEntityType

        public final boolean isEntityType()
        Explicitly, an entity type is an entity type ;)
        指定者:
        isEntityType 在接口中 Type
        覆盖:
        isEntityType 在类中 AbstractType
        返回:
        True.
      • isMutable

        public boolean isMutable()
        从接口复制的说明: Type
        Are objects of this type mutable. (With respect to the referencing object ... entities and collections are considered immutable because they manage their own internal state.)
        指定者:
        isMutable 在接口中 Type
        返回:
        boolean
      • toString

        public String toString()
        Generates a string representation of this type.
        覆盖:
        toString 在类中 Object
        返回:
        string rep
      • getName

        public String getName()
        For entity types, the name correlates to the associated entity name.
        指定者:
        getName 在接口中 Type
        返回:
        String the Hibernate type name
      • isReferenceToPrimaryKey

        public boolean isReferenceToPrimaryKey()
        Does this association foreign key reference the primary key of the other table? Otherwise, it references a property-ref.
        返回:
        True if this association reference the PK of the associated entity.
      • getRHSUniqueKeyPropertyName

        public String getRHSUniqueKeyPropertyName()
        从接口复制的说明: AssociationType
        The name of a unique property of the associated entity that provides the join key (null if the identifier of an entity, or key of a collection)
        指定者:
        getRHSUniqueKeyPropertyName 在接口中 AssociationType
      • getPropertyName

        public String getPropertyName()
      • getAssociatedEntityName

        public final String getAssociatedEntityName()
        The name of the associated entity.
        返回:
        The associated entity name.
      • getReturnedClass

        public final Class getReturnedClass()
        This returns the wrong class for an entity with a proxy, or for a named entity. Theoretically it should return the proxy class, but it doesn't.

        The problem here is that we do not necessarily have a ref to the associated entity persister (nor to the session factory, to look it up) which is really needed to "do the right thing" here...

        指定者:
        getReturnedClass 在接口中 Type
        返回:
        The entity class.
      • nullSafeGet

        public Object nullSafeGet​(ResultSet rs,
                                  String name,
                                  SharedSessionContractImplementor session,
                                  Object owner)
                           throws HibernateException,
                                  SQLException
        从接口复制的说明: Type
        Extract a value of the mapped class from the JDBC result set. Implementors should handle possibility of null values. This form might be called if the type is known to be a single-column type.
        指定者:
        nullSafeGet 在接口中 Type
        参数:
        rs - The result set from which to extract value.
        name - the column name making up this type value (use to read from result set)
        session - The originating session
        owner - the parent entity
        返回:
        The extracted value
        抛出:
        HibernateException - An error from Hibernate
        SQLException - An error from the JDBC driver
      • nullSafeSet

        public void nullSafeSet​(PreparedStatement st,
                                Object value,
                                int index,
                                boolean[] settable,
                                SharedSessionContractImplementor session)
                         throws SQLException
        从接口复制的说明: Type
        Bind a value represented by an instance of the mapped class to the JDBC prepared statement, 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.
        指定者:
        nullSafeSet 在接口中 Type
        参数:
        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
        抛出:
        SQLException - An error from the JDBC driver
      • nullSafeSet

        public void nullSafeSet​(PreparedStatement st,
                                Object value,
                                int index,
                                SharedSessionContractImplementor session)
                         throws SQLException
        从接口复制的说明: Type
        Bind a value represented by an instance of the mapped class to the JDBC prepared statement. Implementors should handle possibility of null values. A multi-column type should bind parameters starting from index.
        指定者:
        nullSafeSet 在接口中 Type
        参数:
        st - The JDBC prepared statement to which to bind
        value - the object to write
        index - starting parameter bind index
        session - The originating session
        抛出:
        SQLException - An error from the JDBC driver
      • isSame

        public final boolean isSame​(Object x,
                                    Object y)
        Two entities are considered the same when their instances are the same.
        指定者:
        isSame 在接口中 Type
        覆盖:
        isSame 在类中 AbstractType
        参数:
        x - One entity instance
        y - Another entity instance
        返回:
        True if x == y; false otherwise.
      • deepCopy

        public Object deepCopy​(Object value,
                               SessionFactoryImplementor factory)
        从接口复制的说明: Type
        Return a deep copy of the persistent state, stopping at entities and at collections.
        指定者:
        deepCopy 在接口中 Type
        参数:
        value - The value to be copied
        factory - The session factory
        返回:
        The deep copy
      • replace

        public Object replace​(Object original,
                              Object target,
                              SharedSessionContractImplementor session,
                              Object owner,
                              Map copyCache)
                       throws HibernateException
        从接口复制的说明: Type
        During merge, replace the existing (target) value in the entity we are merging to with a new (original) value from the detached entity we are merging. For immutable objects, or null values, it is safe to simply return the first parameter. For mutable objects, it is safe to return a copy of the first parameter. For objects with component values, it might make sense to recursively replace component values.
        指定者:
        replace 在接口中 Type
        参数:
        original - the value from the detached entity being merged
        target - the value in the managed entity
        session - The originating session
        owner - The owner of the value
        copyCache - The cache of already copied/replaced values
        返回:
        the value to be merged
        抛出:
        HibernateException - An error from Hibernate
      • getHashCode

        public int getHashCode​(Object x,
                               SessionFactoryImplementor factory)
        从接口复制的说明: Type
        Get a hash code, consistent with persistence "equality". Again for most types the normal usage is to delegate to the value's hashCode.
        指定者:
        getHashCode 在接口中 Type
        覆盖:
        getHashCode 在类中 AbstractType
        参数:
        x - The value for which to retrieve a hash code
        factory - The session factory
        返回:
        The hash code
      • isEqual

        public boolean isEqual​(Object x,
                               Object y,
                               SessionFactoryImplementor factory)
        从接口复制的说明: Type
        Compare two instances of the class mapped by this type for persistence "equality" (equality of persistent state).

        This should always equate to some form of comparison of the value's internal state. As an example, for something like a date the comparison should be based on its internal "time" state based on the specific portion it is meant to represent (timestamp, date, time).

        指定者:
        isEqual 在接口中 Type
        覆盖:
        isEqual 在类中 AbstractType
        参数:
        x - The first value
        y - The second value
        factory - The session factory
        返回:
        True if there are considered equal (see discussion above).
      • getSemiResolvedType

        public Type getSemiResolvedType​(SessionFactoryImplementor factory)
        从接口复制的说明: Type
        As part of 2-phase loading, when we perform resolving what is the resolved type for this type? Generally speaking the type and its semi-resolved type will be the same. The main deviation from this is in the case of an entity where the type would be the entity type and semi-resolved type would be its identifier type
        指定者:
        getSemiResolvedType 在接口中 Type
        覆盖:
        getSemiResolvedType 在类中 AbstractType
        参数:
        factory - The session factory
        返回:
        The semi-resolved type
      • toLoggableString

        public String toLoggableString​(Object value,
                                       SessionFactoryImplementor factory)
        Generate a loggable representation of an instance of the value mapped by this type.
        指定者:
        toLoggableString 在接口中 Type
        参数:
        value - The instance to be logged.
        factory - The session factory.
        返回:
        The loggable string.
        抛出:
        HibernateException - Generally some form of resolution problem.
      • isOneToOne

        public abstract boolean isOneToOne()
        Is the association modeled here defined as a 1-1 in the database (physical model)?
        返回:
        True if a 1-1 in the database; false otherwise.
      • isLogicalOneToOne

        public boolean isLogicalOneToOne()
        Is the association modeled here a 1-1 according to the logical model?
        返回:
        True if a 1-1 in the logical model; false otherwise.
      • getIdentifierOrUniqueKeyType

        public final Type getIdentifierOrUniqueKeyType​(Mapping factory)
                                                throws MappingException
        Determine the type of either (1) the identifier if we reference the associated entity's PK or (2) the unique key to which we refer (i.e. the property-ref).
        参数:
        factory - The mappings...
        返回:
        The appropriate type.
        抛出:
        MappingException - Generally, if unable to resolve the associated entity name or unique key property name.
      • getIdentifierOrUniqueKeyPropertyName

        public final String getIdentifierOrUniqueKeyPropertyName​(Mapping factory)
                                                          throws MappingException
        The name of the property on the associated entity to which our FK refers
        参数:
        factory - The mappings...
        返回:
        The appropriate property name.
        抛出:
        MappingException - Generally, if unable to resolve the associated entity name
      • isNullable

        public abstract boolean isNullable()
        The nullability of the property.
        返回:
        The nullability of the property.
      • loadByUniqueKey

        public Object loadByUniqueKey​(String entityName,
                                      String uniqueKeyPropertyName,
                                      Object key,
                                      SharedSessionContractImplementor session)
                               throws HibernateException
        Load an instance by a unique key that is not the primary key.
        参数:
        entityName - The name of the entity to load
        uniqueKeyPropertyName - The name of the property defining the unique key.
        key - The unique key property value.
        session - The originating session.
        返回:
        The loaded entity
        抛出:
        HibernateException - generally indicates problems performing the load.
      • requireIdentifierOrUniqueKeyType

        protected Type requireIdentifierOrUniqueKeyType​(Mapping mapping)