public abstract class AbstractStandardBasicType<T> extends java.lang.Object implements BasicType, StringRepresentableType<T>, ProcedureParameterExtractionAware<T>, ProcedureParameterNamedBinder
BasicType implementations| Constructor and Description |
|---|
AbstractStandardBasicType(SqlTypeDescriptor sqlTypeDescriptor,
JavaTypeDescriptor<T> javaTypeDescriptor) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
assemble(java.io.Serializable cached,
SharedSessionContractImplementor session,
java.lang.Object owner)
Reconstruct the object from its disassembled state.
|
void |
beforeAssemble(java.io.Serializable cached,
SharedSessionContractImplementor session)
Called before assembling a query result set from the query cache, to allow batch fetching
of entities missing from the second-level cache.
|
boolean |
canDoExtraction()
Can the given instance of this type actually perform the parameter value extractions?
|
boolean |
canDoSetting()
Can the given instance of this type actually set the parameter value by name
|
int |
compare(java.lang.Object x,
java.lang.Object y)
Perform a
Comparator style comparison between values |
java.lang.Object |
deepCopy(java.lang.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.
|
java.io.Serializable |
disassemble(java.lang.Object value,
SharedSessionContractImplementor session,
java.lang.Object owner)
Return a disassembled representation of the object.
|
T |
extract(java.sql.CallableStatement statement,
int startIndex,
SharedSessionContractImplementor session)
Perform the extraction
|
T |
extract(java.sql.CallableStatement statement,
java.lang.String[] paramNames,
SharedSessionContractImplementor session)
Perform the extraction
|
T |
fromString(java.lang.String string) |
T |
fromStringValue(java.lang.String xml)
Consume the given string representation back into this types java form.
|
java.lang.Object |
get(java.sql.ResultSet rs,
java.lang.String name,
SharedSessionContractImplementor session) |
int |
getColumnSpan(Mapping mapping)
How many columns are used to persist this type.
|
protected static Size |
getDefaultSize() |
protected Size |
getDictatedSize() |
int |
getHashCode(java.lang.Object x)
Get a hash code, consistent with persistence "equality".
|
int |
getHashCode(java.lang.Object x,
SessionFactoryImplementor factory)
Get a hash code, consistent with persistence "equality".
|
JavaTypeDescriptor<T> |
getJavaTypeDescriptor() |
protected MutabilityPlan<T> |
getMutabilityPlan() |
java.lang.String[] |
getRegistrationKeys()
Get the names under which this type should be registered in the type registry.
|
protected T |
getReplacement(T original,
T target,
SharedSessionContractImplementor session) |
java.lang.Class |
getReturnedClass()
|
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() |
java.lang.Object |
hydrate(java.sql.ResultSet rs,
java.lang.String[] names,
SharedSessionContractImplementor session,
java.lang.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(java.lang.Object old,
java.lang.Object current) |
boolean |
isDirty(java.lang.Object old,
java.lang.Object current,
boolean[] checkable,
SharedSessionContractImplementor session)
Should the parent be considered dirty, given both the old and current value?
|
boolean |
isDirty(java.lang.Object old,
java.lang.Object current,
SharedSessionContractImplementor 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(java.lang.Object one,
java.lang.Object another)
Compare two instances of the class mapped by this type for persistence "equality" (equality of persistent
state).
|
boolean |
isEqual(java.lang.Object x,
java.lang.Object y,
SessionFactoryImplementor factory)
Compare two instances of the class mapped by this type for persistence "equality" (equality of persistent
state).
|
boolean |
isModified(java.lang.Object oldHydratedState,
java.lang.Object currentState,
boolean[] checkable,
SharedSessionContractImplementor 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.SharedSessionContractImplementor) methods is that here we need to account for "partially" built values. |
boolean |
isMutable()
Are objects of this type mutable.
|
boolean |
isSame(java.lang.Object x,
java.lang.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() |
java.lang.Object |
nullSafeGet(java.sql.ResultSet rs,
java.lang.String[] names,
SharedSessionContractImplementor session,
java.lang.Object owner)
Extract a value of the
mapped class from the JDBC result set. |
T |
nullSafeGet(java.sql.ResultSet rs,
java.lang.String name,
SharedSessionContractImplementor session) |
java.lang.Object |
nullSafeGet(java.sql.ResultSet rs,
java.lang.String name,
SharedSessionContractImplementor session,
java.lang.Object owner)
Extract a value of the
mapped class from the JDBC result set. |
protected T |
nullSafeGet(java.sql.ResultSet rs,
java.lang.String name,
WrapperOptions options) |
void |
nullSafeSet(java.sql.CallableStatement st,
java.lang.Object value,
java.lang.String name,
SharedSessionContractImplementor session)
Bind a value to the JDBC prepared statement, ignoring some columns as dictated by the 'settable' parameter.
|
protected void |
nullSafeSet(java.sql.CallableStatement st,
java.lang.Object value,
java.lang.String name,
WrapperOptions options) |
void |
nullSafeSet(java.sql.PreparedStatement st,
java.lang.Object value,
int index,
SharedSessionContractImplementor session)
Bind a value represented by an instance of the
mapped class to the JDBC prepared
statement. |
protected void |
nullSafeSet(java.sql.PreparedStatement st,
java.lang.Object value,
int index,
WrapperOptions options) |
protected boolean |
registerUnderJavaType() |
protected SqlTypeDescriptor |
remapSqlTypeDescriptor(WrapperOptions options) |
java.lang.Object |
replace(java.lang.Object original,
java.lang.Object target,
SharedSessionContractImplementor session,
java.lang.Object owner,
java.util.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.
|
java.lang.Object |
replace(java.lang.Object original,
java.lang.Object target,
SharedSessionContractImplementor session,
java.lang.Object owner,
java.util.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.
|
java.lang.Object |
resolve(java.lang.Object value,
SharedSessionContractImplementor session,
java.lang.Object owner) |
java.lang.Object |
semiResolve(java.lang.Object value,
SharedSessionContractImplementor session,
java.lang.Object owner)
Given a hydrated, but unresolved value, return a value that may be used to reconstruct property-ref
associations.
|
void |
set(java.sql.PreparedStatement st,
T value,
int index,
SharedSessionContractImplementor session) |
void |
setJavaTypeDescriptor(JavaTypeDescriptor<T> javaTypeDescriptor) |
void |
setSqlTypeDescriptor(SqlTypeDescriptor sqlTypeDescriptor) |
int[] |
sqlTypes(Mapping mapping)
Return the JDBC types codes (per
Types) for the columns mapped by this type. |
boolean[] |
toColumnNullness(java.lang.Object value,
Mapping mapping)
Given an instance of the type, return an array of boolean, indicating
which mapped columns would be null.
|
java.lang.String |
toLoggableString(java.lang.Object value,
SessionFactoryImplementor factory)
Generate a representation of the value for logging purposes.
|
java.lang.String |
toString(T value)
Render the value to the string representation.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetName, nullSafeSet, resolvepublic AbstractStandardBasicType(SqlTypeDescriptor sqlTypeDescriptor, JavaTypeDescriptor<T> javaTypeDescriptor)
public T fromString(java.lang.String string)
public java.lang.String toString(T value)
StringRepresentableTypetoString in interface StringRepresentableType<T>value - The value to render to string.public T fromStringValue(java.lang.String xml) throws HibernateException
StringRepresentableTypefromStringValue in interface StringRepresentableType<T>xml - The string representation to be consumed.HibernateException - Problem consumingprotected MutabilityPlan<T> getMutabilityPlan()
protected T getReplacement(T original, T target, SharedSessionContractImplementor session)
public boolean[] toColumnNullness(java.lang.Object value,
Mapping mapping)
TypetoColumnNullness in interface Typevalue - an instance of the typemapping - The mapping abstractionpublic java.lang.String[] getRegistrationKeys()
BasicTypegetRegistrationKeys in interface BasicTypeprotected boolean registerUnderJavaType()
protected static Size getDefaultSize()
protected Size getDictatedSize()
public final JavaTypeDescriptor<T> getJavaTypeDescriptor()
public final void setJavaTypeDescriptor(JavaTypeDescriptor<T> javaTypeDescriptor)
public final SqlTypeDescriptor getSqlTypeDescriptor()
public final void setSqlTypeDescriptor(SqlTypeDescriptor sqlTypeDescriptor)
public final java.lang.Class getReturnedClass()
TypeType.nullSafeGet(java.sql.ResultSet, java.lang.String[], org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object) methods. This is used to establish the class of an array of
this type.getReturnedClass in interface Typepublic final int getColumnSpan(Mapping mapping) throws MappingException
TypesqlTypes(mapping).lengthgetColumnSpan 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.public final boolean isXMLElement()
public final boolean isSame(java.lang.Object x,
java.lang.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)public final boolean isEqual(java.lang.Object x,
java.lang.Object y,
SessionFactoryImplementor factory)
Typepublic final boolean isEqual(java.lang.Object one,
java.lang.Object another)
Typepublic final int getHashCode(java.lang.Object x)
TypehashCode.getHashCode in interface Typex - The value for which to retrieve a hash codepublic final int getHashCode(java.lang.Object x,
SessionFactoryImplementor factory)
TypehashCode.getHashCode in interface Typex - The value for which to retrieve a hash codefactory - The session factorypublic final int compare(java.lang.Object x,
java.lang.Object y)
TypeComparator style comparison between valuespublic final boolean isDirty(java.lang.Object old,
java.lang.Object current,
SharedSessionContractImplementor session)
Typepublic final boolean isDirty(java.lang.Object old,
java.lang.Object current,
boolean[] checkable,
SharedSessionContractImplementor session)
Typeprotected final boolean isDirty(java.lang.Object old,
java.lang.Object current)
public final boolean isModified(java.lang.Object oldHydratedState,
java.lang.Object currentState,
boolean[] checkable,
SharedSessionContractImplementor session)
TypeType.isDirty(java.lang.Object, java.lang.Object, org.hibernate.engine.spi.SharedSessionContractImplementor) 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.SharedSessionContractImplementor) 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 java.lang.Object nullSafeGet(java.sql.ResultSet rs,
java.lang.String[] names,
SharedSessionContractImplementor session,
java.lang.Object owner)
throws java.sql.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 entityjava.sql.SQLException - An error from the JDBC driveralternative, 2-phase property initializationpublic final java.lang.Object nullSafeGet(java.sql.ResultSet rs,
java.lang.String name,
SharedSessionContractImplementor session,
java.lang.Object owner)
throws java.sql.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 entityjava.sql.SQLException - An error from the JDBC driverpublic final T nullSafeGet(java.sql.ResultSet rs, java.lang.String name, SharedSessionContractImplementor session) throws java.sql.SQLException
java.sql.SQLExceptionprotected final T nullSafeGet(java.sql.ResultSet rs, java.lang.String name, WrapperOptions options) throws java.sql.SQLException
java.sql.SQLExceptionpublic java.lang.Object get(java.sql.ResultSet rs,
java.lang.String name,
SharedSessionContractImplementor session)
throws HibernateException,
java.sql.SQLException
HibernateExceptionjava.sql.SQLExceptionpublic final void nullSafeSet(java.sql.PreparedStatement st,
java.lang.Object value,
int index,
SharedSessionContractImplementor session)
throws java.sql.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 sessionjava.sql.SQLException - An error from the JDBC driverprotected final void nullSafeSet(java.sql.PreparedStatement st,
java.lang.Object value,
int index,
WrapperOptions options)
throws java.sql.SQLException
java.sql.SQLExceptionprotected SqlTypeDescriptor remapSqlTypeDescriptor(WrapperOptions options)
public void set(java.sql.PreparedStatement st,
T value,
int index,
SharedSessionContractImplementor session)
throws HibernateException,
java.sql.SQLException
HibernateExceptionjava.sql.SQLExceptionpublic final java.lang.String toLoggableString(java.lang.Object value,
SessionFactoryImplementor factory)
TypetoLoggableString in interface Typevalue - The value to be loggedfactory - The session factorypublic final boolean isMutable()
Typepublic final java.lang.Object deepCopy(java.lang.Object value,
SessionFactoryImplementor factory)
Typepublic final java.io.Serializable disassemble(java.lang.Object value,
SharedSessionContractImplementor session,
java.lang.Object owner)
throws HibernateException
Typedisassemble in interface Typevalue - the value to cachesession - the originating sessionowner - optional parent entity object (needed for collections)HibernateException - An error from Hibernatepublic final java.lang.Object assemble(java.io.Serializable cached,
SharedSessionContractImplementor session,
java.lang.Object owner)
throws HibernateException
TypeType.disassemble(java.lang.Object, org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object)assemble in interface Typecached - the disassembled state from the cachesession - the originating sessionowner - the parent entity objectHibernateException - An error from Hibernatepublic final void beforeAssemble(java.io.Serializable cached,
SharedSessionContractImplementor session)
TypebeforeAssemble in interface Typecached - The keysession - The originating sessionpublic final java.lang.Object hydrate(java.sql.ResultSet rs,
java.lang.String[] names,
SharedSessionContractImplementor session,
java.lang.Object owner)
throws HibernateException,
java.sql.SQLException
TypeType.resolve(java.lang.Object, org.hibernate.engine.spi.SharedSessionContractImplementor, 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 entityHibernateException - An error from Hibernatejava.sql.SQLException - An error from the JDBC driverType.resolve(java.lang.Object, org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object)public final java.lang.Object resolve(java.lang.Object value,
SharedSessionContractImplementor session,
java.lang.Object owner)
throws HibernateException
resolve in interface TypeHibernateExceptionType.resolve(Object, SharedSessionContractImplementor, Object, Boolean)public final java.lang.Object semiResolve(java.lang.Object value,
SharedSessionContractImplementor session,
java.lang.Object owner)
throws HibernateException
TypesemiResolve in interface Typevalue - The unresolved, hydrated valuesession - THe originating sessionowner - The value ownerHibernateException - An error from Hibernatepublic final Type getSemiResolvedType(SessionFactoryImplementor factory)
TypegetSemiResolvedType in interface Typefactory - The session factorypublic final java.lang.Object replace(java.lang.Object original,
java.lang.Object target,
SharedSessionContractImplementor session,
java.lang.Object owner,
java.util.Map copyCache)
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 valuespublic java.lang.Object replace(java.lang.Object original,
java.lang.Object target,
SharedSessionContractImplementor session,
java.lang.Object owner,
java.util.Map copyCache,
ForeignKeyDirection foreignKeyDirection)
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 valuesforeignKeyDirection - For associations, which direction does the foreign key point?public boolean canDoExtraction()
ProcedureParameterExtractionAwarecanDoExtraction in interface ProcedureParameterExtractionAware<T>true indicates that @{link #extract} calls will not fail due to IllegalStateException.public T extract(java.sql.CallableStatement statement, int startIndex, SharedSessionContractImplementor session) throws java.sql.SQLException
ProcedureParameterExtractionAwareextract in interface ProcedureParameterExtractionAware<T>statement - The CallableStatement from which to extract the parameter value(s).startIndex - The parameter index from which to start extracting; assumes the values (if multiple) are contiguoussession - The originating sessionjava.sql.SQLException - Indicates an issue calling into the CallableStatementpublic T extract(java.sql.CallableStatement statement, java.lang.String[] paramNames, SharedSessionContractImplementor session) throws java.sql.SQLException
ProcedureParameterExtractionAwareextract in interface ProcedureParameterExtractionAware<T>statement - The CallableStatement from which to extract the parameter value(s).paramNames - The parameter names.session - The originating sessionjava.sql.SQLException - Indicates an issue calling into the CallableStatementpublic void nullSafeSet(java.sql.CallableStatement st,
java.lang.Object value,
java.lang.String name,
SharedSessionContractImplementor session)
throws java.sql.SQLException
ProcedureParameterNamedBindernullSafeSet in interface ProcedureParameterNamedBinderst - The CallableStatement to which to bindvalue - the object to writename - parameter bind namesession - The originating sessionjava.sql.SQLException - An error from the JDBC driverprotected final void nullSafeSet(java.sql.CallableStatement st,
java.lang.Object value,
java.lang.String name,
WrapperOptions options)
throws java.sql.SQLException
java.sql.SQLExceptionpublic boolean canDoSetting()
ProcedureParameterNamedBindercanDoSetting in interface ProcedureParameterNamedBindertrue indicates that @{link #nullSafeSet} calls will not failCopyright © 2001-2018 Red Hat, Inc. All Rights Reserved.