Save This Page
Home » hibernate-distribution-3.3.1.GA-dist » org.hibernate » type » [javadoc | source]
org.hibernate.type
abstract public class: EntityType [javadoc | source]
java.lang.Object
   org.hibernate.type.AbstractType
      org.hibernate.type.EntityType

All Implemented Interfaces:
    AssociationType, Type

Direct Known Subclasses:
    OneToOneType, ManyToOneType, SpecialOneToOneType

Base for types which map associations to persistent entities.
Field Summary
protected final  String uniqueKeyPropertyName     
protected final  boolean isEmbeddedInXML     
Constructor:
 protected EntityType(String entityName,
    String uniqueKeyPropertyName,
    boolean eager,
    boolean isEmbeddedInXML,
    boolean unwrapProxy) 
    Constructs the requested entity type mapping.
    Parameters:
    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.
    isEmbeddedInXML - Should values of this mapping be embedded in XML modes?
    unwrapProxy - Is unwrapping of proxies allowed for this association; unwrapping says to return the "implementation target" of lazy prooxies; typically only possible with lazy="no-proxy".
Method from org.hibernate.type.EntityType Summary:
compare,   deepCopy,   fromXMLNode,   getAssociatedEntityName,   getAssociatedEntityName,   getAssociatedJoinable,   getHashCode,   getIdentifier,   getIdentifierOrUniqueKeyPropertyName,   getIdentifierOrUniqueKeyType,   getIdentifierType,   getIdentifierType,   getLHSPropertyName,   getName,   getOnCondition,   getPropertyName,   getRHSUniqueKeyPropertyName,   getReturnedClass,   getSemiResolvedType,   isAssociationType,   isEmbeddedInXML,   isEntityType,   isEqual,   isMutable,   isNotEmbedded,   isNull,   isNullable,   isOneToOne,   isReferenceToPrimaryKey,   isSame,   isXMLElement,   loadByUniqueKey,   nullSafeGet,   nullSafeGet,   replace,   resolve,   resolveIdentifier,   setToXMLNode,   toLoggableString,   toString
Methods from org.hibernate.type.AbstractType:
assemble,   beforeAssemble,   compare,   disassemble,   getHashCode,   getHashCode,   getSemiResolvedType,   hydrate,   isAnyType,   isAssociationType,   isCollectionType,   isComponentType,   isDirty,   isEntityType,   isEqual,   isEqual,   isModified,   isSame,   isXMLElement,   replace,   replaceNode,   resolve,   semiResolve
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.hibernate.type.EntityType Detail:
 public int compare(Object x,
    Object y,
    EntityMode entityMode) 
    {@inheritDoc}
 public Object deepCopy(Object value,
    EntityMode entityMode,
    SessionFactoryImplementor factory) 
    {@inheritDoc}
 public Object fromXMLNode(Node xml,
    Mapping factory) throws HibernateException 
    {@inheritDoc}
 public final String getAssociatedEntityName() 
    The name of the associated entity.
 public String getAssociatedEntityName(SessionFactoryImplementor factory) 
    The name of the associated entity.
 public Joinable getAssociatedJoinable(SessionFactoryImplementor factory) throws MappingException 
    Retrieves the Joinable defining the associated entity.
 public int getHashCode(Object x,
    EntityMode entityMode,
    SessionFactoryImplementor factory) 
    {@inheritDoc}
 protected final Object getIdentifier(Object value,
    SessionImplementor session) throws HibernateException 
 public final String getIdentifierOrUniqueKeyPropertyName(Mapping factory) throws MappingException 
    The name of the property on the associated entity to which our FK refers
 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).
 Type getIdentifierType(Mapping factory) 
    Convenience method to locate the identifier type of the associated entity.
 Type getIdentifierType(SessionImplementor session) 
    Convenience method to locate the identifier type of the associated entity.
 public String getLHSPropertyName() 
 public String getName() 
    For entity types, the name correlates to the associated entity name.
 public String getOnCondition(String alias,
    SessionFactoryImplementor factory,
    Map enabledFilters) throws MappingException 
 public String getPropertyName() 
 public String getRHSUniqueKeyPropertyName() 
 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...

 public Type getSemiResolvedType(SessionFactoryImplementor factory) 
 public boolean isAssociationType() 
    An entity type is a type of association type
 public boolean isEmbeddedInXML() 
    {@inheritDoc}
 public final boolean isEntityType() 
    Explicitly, an entity type is an entity type ;)
 public boolean isEqual(Object x,
    Object y,
    EntityMode entityMode,
    SessionFactoryImplementor factory) 
    {@inheritDoc}
 public boolean isMutable() 
    {@inheritDoc}
 protected boolean isNotEmbedded(SessionImplementor session) 
 protected boolean isNull(Object owner,
    SessionImplementor session) 
 abstract protected boolean isNullable()
 abstract public boolean isOneToOne()
 public boolean isReferenceToPrimaryKey() 
    Does this association foreign key reference the primary key of the other table? Otherwise, it references a property-ref.
 public final boolean isSame(Object x,
    Object y,
    EntityMode entityMode) 
    Two entities are considered the same when their instances are the same.
 public boolean isXMLElement() 
    {@inheritDoc}
 public Object loadByUniqueKey(String entityName,
    String uniqueKeyPropertyName,
    Object key,
    SessionImplementor session) throws HibernateException 
    Load an instance by a unique key that is not the primary key.
 public Object nullSafeGet(ResultSet rs,
    String name,
    SessionImplementor session,
    Object owner) throws HibernateException, SQLException 
    {@inheritDoc}
 public final Object nullSafeGet(ResultSet rs,
    String[] names,
    SessionImplementor session,
    Object owner) throws HibernateException, SQLException 
    {@inheritDoc}
 public Object replace(Object original,
    Object target,
    SessionImplementor session,
    Object owner,
    Map copyCache) throws HibernateException 
    {@inheritDoc}
 public Object resolve(Object value,
    SessionImplementor session,
    Object owner) throws HibernateException 
    Resolve an identifier or unique key value
 protected final Object resolveIdentifier(Serializable id,
    SessionImplementor session) throws HibernateException 
    Resolve an identifier via a load.
 public  void setToXMLNode(Node node,
    Object value,
    SessionFactoryImplementor factory) throws HibernateException 
    {@inheritDoc}
 public String toLoggableString(Object value,
    SessionFactoryImplementor factory) 
    Generate a loggable representation of an instance of the value mapped by this type.
 public String toString() 
    Generates a string representation of this type.