|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.hibernate.type.AbstractStandardBasicType<T>
public abstract class AbstractStandardBasicType<T>
TODO : javadoc
| Constructor Summary | |
|---|---|
AbstractStandardBasicType(SqlTypeDescriptor sqlTypeDescriptor,
JavaTypeDescriptor<T> javaTypeDescriptor)
|
|
| Method Summary | |
|---|---|
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 |
Object |
deepCopy(Object value,
SessionFactoryImplementor factory)
Return a deep copy of the persistent state, stopping at entities and at collections. |
protected T |
deepCopy(T value)
|
Size[] |
defaultSizes(Mapping mapping)
Defines the column sizes to use according to this type if the user did not explicitly say (and if no Type.dictatedSizes(org.hibernate.engine.spi.Mapping) were given). |
Size[] |
dictatedSizes(Mapping mapping)
Return the column sizes dictated by this type. |
Serializable |
disassemble(Object value,
SessionImplementor session,
Object owner)
Return a disassembled representation of the object. |
T |
fromString(String string)
|
T |
fromStringValue(String xml)
Consume the given string representation back into this types java form. |
Object |
fromXMLNode(org.dom4j.Node xml,
Mapping factory)
Parse the XML representation of an instance. |
T |
fromXMLString(String xml,
Mapping factory)
|
Object |
get(ResultSet rs,
String name,
SessionImplementor session)
|
int |
getColumnSpan(Mapping mapping)
How many columns are used to persist this type. |
protected static Size |
getDefaultSize()
|
protected Size |
getDictatedSize()
|
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". |
JavaTypeDescriptor<T> |
getJavaTypeDescriptor()
|
protected MutabilityPlan<T> |
getMutabilityPlan()
|
String[] |
getRegistrationKeys()
Get the names under which this type should be registered in the type registry. |
protected T |
getReplacement(T original,
T target,
SessionImplementor session)
|
Class |
getReturnedClass()
The class returned by Type.nullSafeGet(java.sql.ResultSet, java.lang.String[], org.hibernate.engine.spi.SessionImplementor, java.lang.Object) methods. |
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. |
SqlTypeDescriptor |
getSqlTypeDescriptor()
|
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. |
protected boolean |
isDirty(Object old,
Object current)
|
boolean |
isDirty(Object old,
Object current,
boolean[] checkable,
SessionImplementor session)
Should the parent be considered dirty, given both the old and current value? |
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 one,
Object another)
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 oldHydratedState,
Object currentState,
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 |
isMutable()
Are objects of this type mutable. |
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 |
nullSafeGet(ResultSet rs,
String[] names,
SessionImplementor session,
Object owner)
Extract a value of the mapped class from the JDBC result set. |
T |
nullSafeGet(ResultSet rs,
String name,
SessionImplementor session)
|
Object |
nullSafeGet(ResultSet rs,
String name,
SessionImplementor session,
Object owner)
Extract a value of the mapped class from the JDBC result set. |
protected T |
nullSafeGet(ResultSet rs,
String name,
WrapperOptions options)
|
void |
nullSafeSet(PreparedStatement st,
Object value,
int index,
SessionImplementor session)
Bind a value represented by an instance of the mapped class to the JDBC prepared
statement. |
protected void |
nullSafeSet(PreparedStatement st,
Object value,
int index,
WrapperOptions options)
|
protected boolean |
registerUnderJavaType()
|
protected SqlTypeDescriptor |
remapSqlTypeDescriptor(WrapperOptions options)
|
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 |
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. |
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. |
void |
set(PreparedStatement st,
T value,
int index,
SessionImplementor session)
|
void |
setToXMLNode(org.dom4j.Node node,
Object value,
SessionFactoryImplementor factory)
A representation of the value to be embedded in an XML element. |
int[] |
sqlTypes(Mapping mapping)
Return the JDBC types codes (per Types) for the columns mapped by this type. |
boolean[] |
toColumnNullness(Object value,
Mapping mapping)
Given an instance of the type, return an array of boolean, indicating which mapped columns would be null. |
String |
toLoggableString(Object value,
SessionFactoryImplementor factory)
Generate a representation of the value for logging purposes. |
String |
toString(T value)
Render the value to the string representation. |
String |
toXMLString(T value,
SessionFactoryImplementor factory)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.hibernate.type.Type |
|---|
getName, nullSafeSet |
| Constructor Detail |
|---|
public AbstractStandardBasicType(SqlTypeDescriptor sqlTypeDescriptor,
JavaTypeDescriptor<T> javaTypeDescriptor)
| Method Detail |
|---|
public T fromString(String string)
public String toString(T value)
StringRepresentableType
toString in interface StringRepresentableType<T>value - The value to render to string.
public T fromStringValue(String xml)
throws HibernateException
StringRepresentableType
fromStringValue in interface StringRepresentableType<T>xml - The string representation to be consumed.
HibernateException - Problem consuming
public String toXMLString(T value,
SessionFactoryImplementor factory)
throws HibernateException
toXMLString in interface XmlRepresentableType<T>HibernateException
public T fromXMLString(String xml,
Mapping factory)
throws HibernateException
fromXMLString in interface XmlRepresentableType<T>HibernateExceptionprotected MutabilityPlan<T> getMutabilityPlan()
protected T getReplacement(T original,
T target,
SessionImplementor session)
public boolean[] toColumnNullness(Object value,
Mapping mapping)
Type
toColumnNullness in interface Typevalue - an instance of the typemapping - The mapping abstraction
public String[] getRegistrationKeys()
BasicType
getRegistrationKeys in interface BasicTypeprotected boolean registerUnderJavaType()
protected static Size getDefaultSize()
protected Size getDictatedSize()
public final JavaTypeDescriptor<T> getJavaTypeDescriptor()
public final SqlTypeDescriptor getSqlTypeDescriptor()
public final Class getReturnedClass()
TypeType.nullSafeGet(java.sql.ResultSet, java.lang.String[], org.hibernate.engine.spi.SessionImplementor, java.lang.Object) methods. This is used to establish the class of an array of
this type.
getReturnedClass in interface Type
public final int getColumnSpan(Mapping mapping)
throws MappingException
TypesqlTypes(mapping).length
getColumnSpan in interface Typemapping - The mapping object :/
MappingException - Generally indicates an issue accessing the passed mapping object.
public final int[] sqlTypes(Mapping mapping)
throws MappingException
TypeTypes) for the columns mapped by this type.
NOTE: The number of elements in this array matches the return from Type.getColumnSpan(org.hibernate.engine.spi.Mapping).
sqlTypes in interface Typemapping - The mapping object :/
MappingException - Generally indicates an issue accessing the passed mapping object.
public Size[] dictatedSizes(Mapping mapping)
throws MappingException
Typechar/Character would
have a dictated length limit of 1; for a string-based UUID would have a size limit of 36; etc.
NOTE: The number of elements in this array matches the return from Type.getColumnSpan(org.hibernate.engine.spi.Mapping).
dictatedSizes in interface Typemapping - The mapping object :/
MappingException - Generally indicates an issue accessing the passed mapping object.
public Size[] defaultSizes(Mapping mapping)
throws MappingException
TypeType.dictatedSizes(org.hibernate.engine.spi.Mapping) were given).
NOTE: The number of elements in this array matches the return from Type.getColumnSpan(org.hibernate.engine.spi.Mapping).
defaultSizes in interface Typemapping - The mapping object :/
MappingException - Generally indicates an issue accessing the passed mapping object.public final boolean isAssociationType()
TypeAssociationType. This does not necessarily imply that
the type actually represents an association. Essentially a polymorphic version of
(type instanceof AssociationType.class)
isAssociationType in interface TypeAssociationType implementor; false otherwise.public final boolean isCollectionType()
TypeCollectionType. 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 TypeCollectionType implementor; false otherwise.public final boolean isComponentType()
TypeCompositeType. 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 TypeCompositeType implementor; false otherwise.public final boolean isEntityType()
TypeEntityType. 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 TypeEntityType implementor; false otherwise.public final boolean isAnyType()
TypeAnyType. 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.
isAnyType in interface TypeAnyType implementor; false otherwise.public final boolean isXMLElement()
isXMLElement in interface Type
public final boolean isSame(Object x,
Object y)
Typeequals 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 Typex - The first valuey - The second value
public final boolean isEqual(Object x,
Object y,
SessionFactoryImplementor factory)
Type
isEqual in interface Typex - The first valuey - The second valuefactory - The session factory
public final boolean isEqual(Object one,
Object another)
Type
isEqual in interface Typeone - The first valueanother - The second value
public final int getHashCode(Object x)
TypehashCode.
getHashCode in interface Typex - The value for which to retrieve a hash code
public final int getHashCode(Object x,
SessionFactoryImplementor factory)
TypehashCode.
getHashCode in interface Typex - The value for which to retrieve a hash codefactory - The session factory
public final int compare(Object x,
Object y)
TypeComparator style comparison between values
compare in interface Typex - The first valuey - The second value
Comparator.compare(T, T) for a discussion.
public final boolean isDirty(Object old,
Object current,
SessionImplementor session)
Type
isDirty in interface Typeold - the old valuecurrent - the current valuesession - The session from which the request originated.
public final boolean isDirty(Object old,
Object current,
boolean[] checkable,
SessionImplementor session)
Type
isDirty in interface Typeold - the old valuecurrent - the current valuecheckable - An array of booleans indicating which columns making up the value are actually checkablesession - The session from which the request originated.
protected final boolean isDirty(Object old,
Object current)
public final boolean isModified(Object oldHydratedState,
Object currentState,
boolean[] checkable,
SessionImplementor session)
TypeType.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 TypeoldHydratedState - the database state, in a "hydrated" form, with identifiers unresolvedcurrentState - the current state of the objectcheckable - which columns are actually updatablesession - The session from which the request originated.
public final Object nullSafeGet(ResultSet rs,
String[] names,
SessionImplementor session,
Object owner)
throws 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 entity
SQLException - An error from the JDBC driveralternative, 2-phase property initialization
public final Object nullSafeGet(ResultSet rs,
String name,
SessionImplementor session,
Object owner)
throws 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 entity
SQLException - An error from the JDBC driver
public final T nullSafeGet(ResultSet rs,
String name,
SessionImplementor session)
throws SQLException
SQLException
protected final T nullSafeGet(ResultSet rs,
String name,
WrapperOptions options)
throws SQLException
SQLException
public Object get(ResultSet rs,
String name,
SessionImplementor session)
throws HibernateException,
SQLException
HibernateException
SQLException
public final void nullSafeSet(PreparedStatement st,
Object value,
int index,
SessionImplementor session)
throws SQLException
Typemapped class to the JDBC prepared
statement. Implementors should handle possibility of null values. A multi-column type should bind parameters
starting from index.
nullSafeSet in interface Typest - The JDBC prepared statement to which to bindvalue - the object to writeindex - starting parameter bind indexsession - The originating session
SQLException - An error from the JDBC driver
protected final void nullSafeSet(PreparedStatement st,
Object value,
int index,
WrapperOptions options)
throws SQLException
SQLExceptionprotected SqlTypeDescriptor remapSqlTypeDescriptor(WrapperOptions options)
public void set(PreparedStatement st,
T value,
int index,
SessionImplementor session)
throws HibernateException,
SQLException
HibernateException
SQLException
public final String toLoggableString(Object value,
SessionFactoryImplementor factory)
Type
toLoggableString in interface Typevalue - The value to be loggedfactory - The session factory
public final void setToXMLNode(org.dom4j.Node node,
Object value,
SessionFactoryImplementor factory)
Type
setToXMLNode in interface Typenode - The XML node to which to write the valuevalue - The value to writefactory - The session factory
public final Object fromXMLNode(org.dom4j.Node xml,
Mapping factory)
Type
fromXMLNode in interface Typexml - The XML node from which to read the valuefactory - The session factory
mapped classpublic final boolean isMutable()
Type
isMutable in interface Type
public final Object deepCopy(Object value,
SessionFactoryImplementor factory)
Type
deepCopy in interface Typevalue - The value to be copiedfactory - The session factory
protected final T deepCopy(T value)
public final Serializable disassemble(Object value,
SessionImplementor session,
Object owner)
throws HibernateException
Type
disassemble in interface Typevalue - the value to cachesession - the originating sessionowner - optional parent entity object (needed for collections)
HibernateException - An error from Hibernate
public final Object assemble(Serializable cached,
SessionImplementor session,
Object owner)
throws HibernateException
TypeType.disassemble(java.lang.Object, org.hibernate.engine.spi.SessionImplementor, java.lang.Object)
assemble in interface Typecached - the disassembled state from the cachesession - the originating sessionowner - the parent entity object
HibernateException - An error from Hibernate
public final void beforeAssemble(Serializable cached,
SessionImplementor session)
Type
beforeAssemble in interface Typecached - The keysession - The originating session
public final Object hydrate(ResultSet rs,
String[] names,
SessionImplementor session,
Object owner)
throws HibernateException,
SQLException
TypeType.resolve(java.lang.Object, org.hibernate.engine.spi.SessionImplementor, java.lang.Object)
This hydrated value will be either:
hydrate in interface Typers - The JDBC result setnames - the column names making up this type value (use to read from result set)session - The originating sessionowner - the parent entity
HibernateException - An error from Hibernate
SQLException - An error from the JDBC driverType.resolve(java.lang.Object, org.hibernate.engine.spi.SessionImplementor, java.lang.Object)
public final Object resolve(Object value,
SessionImplementor session,
Object owner)
throws HibernateException
Type
resolve in interface Typevalue - an identifier or value returned by hydrate()session - the sessionowner - the parent entity
HibernateException - An error from HibernateType.hydrate(java.sql.ResultSet, java.lang.String[], org.hibernate.engine.spi.SessionImplementor, java.lang.Object)
public final Object semiResolve(Object value,
SessionImplementor session,
Object owner)
throws HibernateException
Type
semiResolve in interface Typevalue - The unresolved, hydrated valuesession - THe originating sessionowner - The value owner
HibernateException - An error from Hibernatepublic final Type getSemiResolvedType(SessionFactoryImplementor factory)
Type
getSemiResolvedType in interface Typefactory - The session factory
public final Object replace(Object original,
Object target,
SessionImplementor session,
Object owner,
Map copyCache)
Type
replace 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 values
public Object replace(Object original,
Object target,
SessionImplementor session,
Object owner,
Map copyCache,
ForeignKeyDirection foreignKeyDirection)
Type
replace 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 valuesforeignKeyDirection - For associations, which direction does the foreign key point?
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||