|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.hibernate.type.AbstractType org.hibernate.type.EntityType
Base for types which map associations to persistent entities.
Field Summary | |
protected boolean |
isEmbeddedInXML
|
protected String |
uniqueKeyPropertyName
|
Constructor Summary | |
protected |
EntityType(String entityName,
String uniqueKeyPropertyName,
boolean eager,
boolean isEmbeddedInXML,
boolean unwrapProxy)
Constructs the requested entity type mapping. |
Method Summary | |
int |
compare(Object x,
Object y,
EntityMode entityMode)
|
Object |
deepCopy(Object value,
EntityMode entityMode,
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. |
Joinable |
getAssociatedJoinable(SessionFactoryImplementor factory)
Retrieves the Joinable defining the associated entity. |
int |
getHashCode(Object x,
EntityMode entityMode,
SessionFactoryImplementor factory)
|
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 |
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)
Get the type of a semi-resolved value. |
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,
EntityMode entityMode,
SessionFactoryImplementor factory)
|
boolean |
isMutable()
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.) |
protected boolean |
isNotEmbedded(SessionImplementor session)
|
protected boolean |
isNull(Object owner,
SessionImplementor session)
|
protected abstract boolean |
isNullable()
|
abstract boolean |
isOneToOne()
|
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,
EntityMode entityMode)
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)
Retrieve an instance of the mapped class from a JDBC resultset. Implementors should handle possibility of null values. |
Object |
nullSafeGet(ResultSet rs,
String name,
SessionImplementor session,
Object owner)
Retrieve an instance of the mapped class from a JDBC resultset. Implementations should handle possibility of null values. This method might be called if the type is known to be a single-column type. |
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. 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. |
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. |
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. |
Methods inherited from class org.hibernate.type.AbstractType |
assemble, beforeAssemble, disassemble, getHashCode, hydrate, isAnyType, isCollectionType, isComponentType, isDirty, isEqual, isModified, replace, replaceNode, semiResolve |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.hibernate.type.AssociationType |
getForeignKeyDirection, isAlwaysDirtyChecked, useLHSPrimaryKey |
Methods inherited from interface org.hibernate.type.Type |
assemble, beforeAssemble, disassemble, getColumnSpan, getHashCode, hydrate, isAnyType, isCollectionType, isComponentType, isDirty, isDirty, isEqual, isModified, nullSafeSet, nullSafeSet, replace, semiResolve, sqlTypes, toColumnNullness |
Field Detail |
protected final String uniqueKeyPropertyName
protected final boolean isEmbeddedInXML
Constructor Detail |
protected EntityType(String entityName, String uniqueKeyPropertyName, boolean eager, boolean isEmbeddedInXML, boolean unwrapProxy)
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 Detail |
public boolean isAssociationType()
isAssociationType
in interface Type
isAssociationType
in class AbstractType
public final boolean isEntityType()
isEntityType
in interface Type
isEntityType
in class AbstractType
public boolean isMutable()
public String toString()
public String getName()
public boolean isReferenceToPrimaryKey()
public String getRHSUniqueKeyPropertyName()
AssociationType
getRHSUniqueKeyPropertyName
in interface AssociationType
public String getLHSPropertyName()
AssociationType
getLHSPropertyName
in interface AssociationType
public String getPropertyName()
public final String getAssociatedEntityName()
public String getAssociatedEntityName(SessionFactoryImplementor factory)
getAssociatedEntityName
in interface AssociationType
factory
- The session factory, for resolution.
public Joinable getAssociatedJoinable(SessionFactoryImplementor factory) throws MappingException
Joinable
defining the associated entity.
getAssociatedJoinable
in interface AssociationType
factory
- The session factory.
MappingException
- Generally indicates an invalid entity name.public final Class getReturnedClass()
getReturnedClass
in interface Type
public Object nullSafeGet(ResultSet rs, String name, SessionImplementor session, Object owner) throws HibernateException, SQLException
nullSafeGet
in interface Type
rs
- name
- the column namesession
- owner
- the parent entity
SQLException
HibernateException
public final Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws HibernateException, SQLException
nullSafeGet
in interface Type
rs
- names
- the column namessession
- owner
- the parent entity
SQLException
HibernateException
alternative, 2-phase property initialization
public final boolean isSame(Object x, Object y, EntityMode entityMode)
isSame
in interface Type
isSame
in class AbstractType
x
- One entity instancey
- Another entity instanceentityMode
- The entity mode.
public int compare(Object x, Object y, EntityMode entityMode)
compare
in interface Type
compare
in class AbstractType
public Object deepCopy(Object value, EntityMode entityMode, SessionFactoryImplementor factory)
value
- generally a collection element or entity fieldentityMode
- factory
-
public Object replace(Object original, Object target, SessionImplementor session, Object owner, Map copyCache) throws HibernateException
original
- the value from the detached entity being mergedtarget
- the value in the managed entity
HibernateException
public int getHashCode(Object x, EntityMode entityMode, SessionFactoryImplementor factory)
getHashCode
in interface Type
getHashCode
in class AbstractType
public boolean isEqual(Object x, Object y, EntityMode entityMode, SessionFactoryImplementor factory)
isEqual
in interface Type
isEqual
in class AbstractType
public boolean isEmbeddedInXML()
isEmbeddedInXML
in interface AssociationType
public boolean isXMLElement()
isXMLElement
in interface Type
isXMLElement
in class AbstractType
public Object fromXMLNode(org.dom4j.Node xml, Mapping factory) throws HibernateException
fromXMLNode
in interface Type
xml
- factory
-
HibernateException
public void setToXMLNode(org.dom4j.Node node, Object value, SessionFactoryImplementor factory) throws HibernateException
setToXMLNode
in interface Type
value
- factory
-
HibernateException
public String getOnCondition(String alias, SessionFactoryImplementor factory, Map enabledFilters) throws MappingException
AssociationType
getOnCondition
in interface AssociationType
MappingException
public Object resolve(Object value, SessionImplementor session, Object owner) throws HibernateException
resolve
in interface Type
resolve
in class AbstractType
HibernateException
public Type getSemiResolvedType(SessionFactoryImplementor factory)
Type
getSemiResolvedType
in interface Type
getSemiResolvedType
in class AbstractType
protected final Object getIdentifier(Object value, SessionImplementor session) throws HibernateException
HibernateException
protected boolean isNotEmbedded(SessionImplementor session)
public String toLoggableString(Object value, SessionFactoryImplementor factory)
toLoggableString
in interface Type
value
- The instance to be logged.factory
- The session factory.
HibernateException
- Generally some form of resolution problem.public abstract boolean isOneToOne()
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.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |