public abstract class EntityType extends AbstractType implements AssociationType
| Modifier and Type | Field and Description | 
|---|---|
protected boolean | 
isEmbeddedInXML  | 
protected String | 
uniqueKeyPropertyName  | 
LEGACY_DEFAULT_SIZE, LEGACY_DICTATED_SIZE| Modifier | Constructor and Description | 
|---|---|
protected  | 
EntityType(TypeFactory.TypeScope scope,
          String entityName,
          boolean referenceToPrimaryKey,
          String uniqueKeyPropertyName,
          boolean eager,
          boolean unwrapProxy)
Constructs the requested entity type mapping. 
 | 
protected  | 
EntityType(TypeFactory.TypeScope scope,
          String entityName,
          String uniqueKeyPropertyName,
          boolean eager,
          boolean unwrapProxy)
Deprecated. 
 
 | 
protected  | 
EntityType(TypeFactory.TypeScope scope,
          String entityName,
          String uniqueKeyPropertyName,
          boolean eager,
          boolean isEmbeddedInXML,
          boolean unwrapProxy)
Deprecated. 
 
Use  
EntityType(org.hibernate.type.TypeFactory.TypeScope, String, boolean, String, boolean, boolean) instead.
 See Jira issue: HHH-7771 | 
| Modifier and Type | Method and Description | 
|---|---|
int | 
compare(Object x,
       Object y)
Perform a  
Comparator style comparison between values | 
Object | 
deepCopy(Object value,
        SessionFactoryImplementor factory)
Return a deep copy of the persistent state, stopping at entities and at collections. 
 | 
Object | 
fromXMLNode(org.dom4j.Node xml,
           Mapping factory)
Parse the XML representation of an instance. 
 | 
String | 
getAssociatedEntityName()
The name of the associated entity. 
 | 
String | 
getAssociatedEntityName(SessionFactoryImplementor factory)
The name of the associated entity. 
 | 
protected EntityPersister | 
getAssociatedEntityPersister(SessionFactoryImplementor factory)  | 
Joinable | 
getAssociatedJoinable(SessionFactoryImplementor factory)
Retrieves the  
Joinable defining the associated entity. | 
int | 
getHashCode(Object x,
           SessionFactoryImplementor factory)
Get a hash code, consistent with persistence "equality". 
 | 
protected Object | 
getIdentifier(Object value,
             SessionImplementor session)  | 
String | 
getIdentifierOrUniqueKeyPropertyName(Mapping factory)
The name of the property on the associated entity to which our FK
 refers 
 | 
Type | 
getIdentifierOrUniqueKeyType(Mapping factory)
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. 
 | 
String | 
getLHSPropertyName()
Get the name of a property in the owning entity 
 that provides the join key (null if the identifier) 
 | 
String | 
getName()
For entity types, the name correlates to the associated entity name. 
 | 
String | 
getOnCondition(String alias,
              SessionFactoryImplementor factory,
              Map enabledFilters)
Get the "filtering" SQL fragment that is applied in the 
 SQL on clause, in addition to the usual join condition 
 | 
String | 
getOnCondition(String alias,
              SessionFactoryImplementor factory,
              Map enabledFilters,
              Set<String> treatAsDeclarations)
Get the "filtering" SQL fragment that is applied in the
 SQL on clause, in addition to the usual join condition 
 | 
String | 
getPropertyName()  | 
Class | 
getReturnedClass()
This returns the wrong class for an entity with a proxy, or for a named
 entity. 
 | 
String | 
getRHSUniqueKeyPropertyName()
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) 
 | 
Type | 
getSemiResolvedType(SessionFactoryImplementor factory)
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. 
 | 
boolean | 
isAssociationType()
An entity type is a type of association type 
 | 
boolean | 
isEmbeddedInXML()  | 
boolean | 
isEntityType()
Explicitly, an entity type is an entity type ;) 
 | 
boolean | 
isEqual(Object x,
       Object y,
       SessionFactoryImplementor factory)
Compare two instances of the class mapped by this type for persistence "equality" (equality of persistent
 state). 
 | 
boolean | 
isLogicalOneToOne()
Is the association modeled here a 1-1 according to the logical moidel? 
 | 
boolean | 
isMutable()
Are objects of this type mutable. 
 | 
protected boolean | 
isNotEmbedded(SessionImplementor session)
Deprecated. 
 
To be removed in 5.  Removed as part of removing the notion of DOM entity-mode.
 See Jira issue: HHH-7771 
 | 
protected boolean | 
isNull(Object owner,
      SessionImplementor session)  | 
protected abstract boolean | 
isNullable()  | 
abstract boolean | 
isOneToOne()
Is the association modeled here defined as a 1-1 in the database (physical model)? 
 | 
boolean | 
isReferenceToPrimaryKey()
Does this association foreign key reference the primary key of the other table?
 Otherwise, it references a property-ref. 
 | 
boolean | 
isSame(Object x,
      Object y)
Two entities are considered the same when their instances are the same. 
 | 
boolean | 
isXMLElement()  | 
Object | 
loadByUniqueKey(String entityName,
               String uniqueKeyPropertyName,
               Object key,
               SessionImplementor session)
Load an instance by a unique key that is not the primary key. 
 | 
Object | 
nullSafeGet(ResultSet rs,
           String[] names,
           SessionImplementor session,
           Object owner)
Extract a value of the  
mapped class from the JDBC result set. | 
Object | 
nullSafeGet(ResultSet rs,
           String name,
           SessionImplementor session,
           Object owner)
Extract a value of the  
mapped class from the JDBC result set. | 
Object | 
replace(Object original,
       Object target,
       SessionImplementor session,
       Object owner,
       Map copyCache)
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. 
 | 
Object | 
resolve(Object value,
       SessionImplementor session,
       Object owner)
Resolve an identifier or unique key value 
 | 
protected Object | 
resolveIdentifier(Serializable id,
                 SessionImplementor session)
Resolve an identifier via a load. 
 | 
protected TypeFactory.TypeScope | 
scope()  | 
void | 
setToXMLNode(org.dom4j.Node node,
            Object value,
            SessionFactoryImplementor factory)
A representation of the value to be embedded in an XML element. 
 | 
String | 
toLoggableString(Object value,
                SessionFactoryImplementor factory)
Generate a loggable representation of an instance of the value mapped by this type. 
 | 
String | 
toString()
Generates a string representation of this type. 
 | 
assemble, beforeAssemble, disassemble, getHashCode, hydrate, isAnyType, isCollectionType, isComponentType, isDirty, isEqual, isModified, replace, replaceNode, semiResolveclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetForeignKeyDirection, isAlwaysDirtyChecked, useLHSPrimaryKeyassemble, beforeAssemble, defaultSizes, dictatedSizes, disassemble, getColumnSpan, getHashCode, hydrate, isAnyType, isCollectionType, isComponentType, isDirty, isDirty, isEqual, isModified, nullSafeSet, nullSafeSet, replace, semiResolve, sqlTypes, toColumnNullnessprotected final String uniqueKeyPropertyName
protected final boolean isEmbeddedInXML
@Deprecated protected EntityType(TypeFactory.TypeScope scope, String entityName, String uniqueKeyPropertyName, boolean eager, boolean isEmbeddedInXML, boolean unwrapProxy)
EntityType(org.hibernate.type.TypeFactory.TypeScope, String, boolean, String, boolean, boolean) instead.
 See Jira issue: HHH-7771scope - The type scopeentityName - 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".@Deprecated protected EntityType(TypeFactory.TypeScope scope, String entityName, String uniqueKeyPropertyName, boolean eager, boolean unwrapProxy)
EntityType(org.hibernate.type.TypeFactory.TypeScope, String, boolean, String, boolean, boolean) instead.scope - The type scopeentityName - 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 prooxies; typically only possible
 with lazy="no-proxy".protected EntityType(TypeFactory.TypeScope scope, String entityName, boolean referenceToPrimaryKey, String uniqueKeyPropertyName, boolean eager, boolean unwrapProxy)
scope - The type scopeentityName - 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 prooxies; typically only possible
 with lazy="no-proxy".protected TypeFactory.TypeScope scope()
public boolean isAssociationType()
isAssociationType in interface TypeisAssociationType in class AbstractTypepublic final boolean isEntityType()
isEntityType in interface TypeisEntityType in class AbstractTypepublic boolean isMutable()
Typepublic String toString()
public String getName()
public boolean isReferenceToPrimaryKey()
public String getRHSUniqueKeyPropertyName()
AssociationTypegetRHSUniqueKeyPropertyName in interface AssociationTypepublic String getLHSPropertyName()
AssociationTypegetLHSPropertyName in interface AssociationTypepublic String getPropertyName()
public final String getAssociatedEntityName()
public String getAssociatedEntityName(SessionFactoryImplementor factory)
getAssociatedEntityName in interface AssociationTypefactory - The session factory, for resolution.public Joinable getAssociatedJoinable(SessionFactoryImplementor factory) throws MappingException
Joinable defining the associated entity.getAssociatedJoinable in interface AssociationTypefactory - The session factory.MappingException - Generally indicates an invalid entity name.public final Class getReturnedClass()
getReturnedClass in interface Typepublic Object nullSafeGet(ResultSet rs, String name, SessionImplementor session, Object owner) throws HibernateException, SQLException
Typemapped 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 in interface Typers - 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 sessionowner - the parent entityHibernateException - An error from HibernateSQLException - An error from the JDBC driverpublic final Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws HibernateException, SQLException
Typemapped class from the JDBC result set. Implementors
 should handle possibility of null values.nullSafeGet in interface Typers - The result set from which to extract value.names - the column names making up this type value (use to read from result set)session - The originating sessionowner - the parent entityHibernateException - An error from HibernateSQLException - An error from the JDBC driveralternative, 2-phase property initializationpublic final boolean isSame(Object x, Object y)
isSame in interface TypeisSame in class AbstractTypex - One entity instancey - Another entity instancepublic int compare(Object x, Object y)
TypeComparator style comparison between valuescompare in interface Typecompare in class AbstractTypex - The first valuey - The second valueComparator.compare(T, T) for a discussion.public Object deepCopy(Object value, SessionFactoryImplementor factory)
Typepublic Object replace(Object original, Object target, SessionImplementor session, Object owner, Map copyCache) throws HibernateException
Typereplace in interface Typeoriginal - the value from the detached entity being mergedtarget - the value in the managed entitysession - The originating sessionowner - The owner of the valuecopyCache - The cache of already copied/replaced valuesHibernateException - An error from Hibernatepublic int getHashCode(Object x, SessionFactoryImplementor factory)
TypehashCode.getHashCode in interface TypegetHashCode in class AbstractTypex - The value for which to retrieve a hash codefactory - The session factorypublic boolean isEqual(Object x, Object y, SessionFactoryImplementor factory)
TypeisEqual in interface TypeisEqual in class AbstractTypex - The first valuey - The second valuefactory - The session factorypublic boolean isEmbeddedInXML()
isEmbeddedInXML in interface AssociationTypepublic boolean isXMLElement()
isXMLElement in interface TypeisXMLElement in class AbstractTypepublic Object fromXMLNode(org.dom4j.Node xml, Mapping factory) throws HibernateException
TypefromXMLNode in interface Typexml - The XML node from which to read the valuefactory - The session factorymapped classHibernateException - An error from Hibernatepublic void setToXMLNode(org.dom4j.Node node,
                Object value,
                SessionFactoryImplementor factory)
                  throws HibernateException
TypesetToXMLNode in interface Typenode - The XML node to which to write the valuevalue - The value to writefactory - The session factoryHibernateException - An error from Hibernatepublic String getOnCondition(String alias, SessionFactoryImplementor factory, Map enabledFilters)
AssociationTypegetOnCondition in interface AssociationTypepublic String getOnCondition(String alias, SessionFactoryImplementor factory, Map enabledFilters, Set<String> treatAsDeclarations)
AssociationTypegetOnCondition in interface AssociationTypepublic Object resolve(Object value, SessionImplementor session, Object owner) throws HibernateException
resolve in interface Typeresolve in class AbstractTypevalue - an identifier or value returned by hydrate()session - the sessionowner - the parent entityHibernateException - An error from HibernateType.hydrate(java.sql.ResultSet, java.lang.String[], org.hibernate.engine.spi.SessionImplementor, java.lang.Object)public Type getSemiResolvedType(SessionFactoryImplementor factory)
TypegetSemiResolvedType in interface TypegetSemiResolvedType in class AbstractTypefactory - The session factoryprotected EntityPersister getAssociatedEntityPersister(SessionFactoryImplementor factory)
protected final Object getIdentifier(Object value, SessionImplementor session) throws HibernateException
HibernateException@Deprecated protected boolean isNotEmbedded(SessionImplementor session)
public String toLoggableString(Object value, SessionFactoryImplementor factory)
toLoggableString in interface Typevalue - The instance to be logged.factory - The session factory.HibernateException - Generally some form of resolution problem.public abstract boolean isOneToOne()
public boolean isLogicalOneToOne()
public final Type getIdentifierOrUniqueKeyType(Mapping factory) throws MappingException
factory - The mappings...MappingException - Generally, if unable to resolve the associated entity name
 or unique key property name.public final String getIdentifierOrUniqueKeyPropertyName(Mapping factory) throws MappingException
factory - The mappings...MappingException - Generally, if unable to resolve the associated entity nameprotected abstract boolean isNullable()
protected final Object resolveIdentifier(Serializable id, SessionImplementor session) throws HibernateException
id - The entity id to resolvesession - The orginating session.HibernateException - Indicates problems performing the load.protected boolean isNull(Object owner, SessionImplementor session)
public Object loadByUniqueKey(String entityName, String uniqueKeyPropertyName, Object key, SessionImplementor session) throws HibernateException
entityName - The name of the entity to loaduniqueKeyPropertyName - The name of the property defining the uniqie key.key - The unique key property value.session - The originating session.HibernateException - generally indicates problems performing the load.Copyright © 2001-2015 Red Hat, Inc. All Rights Reserved.