public abstract class AbstractType extends Object implements Type
Modifier and Type | Field and Description |
---|---|
protected static Size |
LEGACY_DEFAULT_SIZE |
protected static Size |
LEGACY_DICTATED_SIZE |
Constructor and Description |
---|
AbstractType() |
Modifier and Type | Method and Description |
---|---|
Object |
assemble(Serializable cached,
SessionImplementor session,
Object owner)
Reconstruct the object from its disassembled state.
|
void |
beforeAssemble(Serializable cached,
SessionImplementor session)
Called before assembling a query result set from the query cache, to allow batch fetching
of entities missing from the second-level cache.
|
int |
compare(Object x,
Object y)
Perform a
Comparator style comparison between values |
Serializable |
disassemble(Object value,
SessionImplementor session,
Object owner)
Return a disassembled representation of the object.
|
int |
getHashCode(Object x)
Get a hash code, consistent with persistence "equality".
|
int |
getHashCode(Object x,
SessionFactoryImplementor factory)
Get a hash code, consistent with persistence "equality".
|
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.
|
Object |
hydrate(ResultSet rs,
String[] names,
SessionImplementor session,
Object owner)
Extract a value from the JDBC result set.
|
boolean |
isAnyType()
Return true if the implementation is castable to
AnyType . |
boolean |
isAssociationType()
Return true if the implementation is castable to
AssociationType . |
boolean |
isCollectionType()
Return true if the implementation is castable to
CollectionType . |
boolean |
isComponentType()
Return true if the implementation is castable to
CompositeType . |
boolean |
isDirty(Object old,
Object current,
SessionImplementor session)
Should the parent be considered dirty, given both the old and current value?
|
boolean |
isEntityType()
Return true if the implementation is castable to
EntityType . |
boolean |
isEqual(Object x,
Object y)
Compare two instances of the class mapped by this type for persistence "equality" (equality of persistent
state).
|
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 |
isModified(Object old,
Object current,
boolean[] checkable,
SessionImplementor session)
Has the value been modified compared to the current database state? The difference between this
and the
Type.isDirty(java.lang.Object, java.lang.Object, org.hibernate.engine.spi.SessionImplementor) methods is that here we need to account for "partially" built values. |
boolean |
isSame(Object x,
Object y)
Compare two instances of the class mapped by this type for persistence "equality" (equality of persistent
state) taking a shortcut for entity references.
|
boolean |
isXMLElement() |
Object |
replace(Object original,
Object target,
SessionImplementor session,
Object owner,
Map copyCache,
ForeignKeyDirection foreignKeyDirection)
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.
|
protected static void |
replaceNode(org.dom4j.Node container,
org.dom4j.Element value) |
Object |
resolve(Object value,
SessionImplementor session,
Object owner)
The second phase of 2-phase loading.
|
Object |
semiResolve(Object value,
SessionImplementor session,
Object owner)
Given a hydrated, but unresolved value, return a value that may be used to reconstruct property-ref
associations.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
deepCopy, defaultSizes, dictatedSizes, fromXMLNode, getColumnSpan, getName, getReturnedClass, isDirty, isMutable, nullSafeGet, nullSafeGet, nullSafeSet, nullSafeSet, replace, setToXMLNode, sqlTypes, toColumnNullness, toLoggableString
protected static final Size LEGACY_DICTATED_SIZE
protected static final Size LEGACY_DEFAULT_SIZE
public boolean isAssociationType()
Type
AssociationType
. This does not necessarily imply that
the type actually represents an association. Essentially a polymorphic version of
(type instanceof AssociationType.class)
isAssociationType
in interface Type
AssociationType
implementor; false otherwise.public boolean isCollectionType()
Type
CollectionType
. Essentially a polymorphic version of
(type instanceof CollectionType.class)
A CollectionType
is additionally an AssociationType
; so if this method returns true,
Type.isAssociationType()
should also return true.isCollectionType
in interface Type
CollectionType
implementor; false otherwise.public boolean isComponentType()
Type
CompositeType
. Essentially a polymorphic
version of (type instanceof CompositeType.class)
. A component type may own collections or
associations and hence must provide certain extra functionality.isComponentType
in interface Type
CompositeType
implementor; false otherwise.public boolean isEntityType()
Type
EntityType
. Essentially a polymorphic
version of (type instanceof EntityType.class)
.
An EntityType
is additionally an AssociationType
; so if this method returns true,
Type.isAssociationType()
should also return true.isEntityType
in interface Type
EntityType
implementor; false otherwise.public boolean isXMLElement()
isXMLElement
in interface Type
public int compare(Object x, Object y)
Type
Comparator
style comparison between valuescompare
in interface Type
x
- The first valuey
- The second valueComparator.compare(T, T)
for a discussion.public Serializable disassemble(Object value, SessionImplementor session, Object owner) throws HibernateException
Type
disassemble
in interface Type
value
- the value to cachesession
- the originating sessionowner
- optional parent entity object (needed for collections)HibernateException
- An error from Hibernatepublic Object assemble(Serializable cached, SessionImplementor session, Object owner) throws HibernateException
Type
Type.disassemble(java.lang.Object, org.hibernate.engine.spi.SessionImplementor, java.lang.Object)
assemble
in interface Type
cached
- the disassembled state from the cachesession
- the originating sessionowner
- the parent entity objectHibernateException
- An error from Hibernatepublic boolean isDirty(Object old, Object current, SessionImplementor session) throws HibernateException
Type
isDirty
in interface Type
old
- the old valuecurrent
- the current valuesession
- The session from which the request originated.HibernateException
- A problem occurred performing the checkingpublic Object hydrate(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws HibernateException, SQLException
Type
Type.resolve(java.lang.Object, org.hibernate.engine.spi.SessionImplementor, java.lang.Object)
This hydrated value will be either:hydrate
in interface Type
rs
- The JDBC result setnames
- 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 driverType.resolve(java.lang.Object, org.hibernate.engine.spi.SessionImplementor, java.lang.Object)
public Object resolve(Object value, SessionImplementor session, Object owner) throws HibernateException
Type
resolve
in interface Type
value
- 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 Object semiResolve(Object value, SessionImplementor session, Object owner) throws HibernateException
Type
semiResolve
in interface Type
value
- The unresolved, hydrated valuesession
- THe originating sessionowner
- The value ownerHibernateException
- An error from Hibernatepublic boolean isAnyType()
Type
AnyType
. Essentially a polymorphic
version of (type instanceof AnyType.class)
.
An AnyType
is additionally an AssociationType
; so if this method returns true,
Type.isAssociationType()
should also return true.public boolean isModified(Object old, Object current, boolean[] checkable, SessionImplementor session) throws HibernateException
Type
Type.isDirty(java.lang.Object, java.lang.Object, org.hibernate.engine.spi.SessionImplementor)
methods is that here we need to account for "partially" built values. This is really
only an issue with association types. For most type implementations it is enough to simply delegate to
Type.isDirty(java.lang.Object, java.lang.Object, org.hibernate.engine.spi.SessionImplementor)
here/isModified
in interface Type
old
- the database state, in a "hydrated" form, with identifiers unresolvedcurrent
- the current state of the objectcheckable
- which columns are actually updatablesession
- The session from which the request originated.HibernateException
- A problem occurred performing the checkingpublic boolean isSame(Object x, Object y) throws HibernateException
Type
equals
check on the values. For associations
the implication is a bit different. For most types it is conceivable to simply delegate to Type.isEqual(java.lang.Object, java.lang.Object)
isSame
in interface Type
x
- The first valuey
- The second valueHibernateException
- A problem occurred performing the comparisonpublic boolean isEqual(Object x, Object y)
Type
public int getHashCode(Object x)
Type
hashCode
.getHashCode
in interface Type
x
- The value for which to retrieve a hash codepublic boolean isEqual(Object x, Object y, SessionFactoryImplementor factory)
Type
public int getHashCode(Object x, SessionFactoryImplementor factory)
Type
hashCode
.getHashCode
in interface Type
x
- The value for which to retrieve a hash codefactory
- The session factoryprotected static void replaceNode(org.dom4j.Node container, org.dom4j.Element value)
public Type getSemiResolvedType(SessionFactoryImplementor factory)
Type
getSemiResolvedType
in interface Type
factory
- The session factorypublic Object replace(Object original, Object target, SessionImplementor session, Object owner, Map copyCache, ForeignKeyDirection foreignKeyDirection) throws HibernateException
Type
replace
in interface Type
original
- 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 valuesforeignKeyDirection
- For associations, which direction does the foreign key point?HibernateException
- An error from Hibernatepublic void beforeAssemble(Serializable cached, SessionImplementor session)
Type
beforeAssemble
in interface Type
cached
- The keysession
- The originating sessionCopyright © 2001-2013 Red Hat, Inc. All Rights Reserved.