Package org.hibernate.type
Class AbstractStandardBasicType<T>
- java.lang.Object
-
- org.hibernate.type.AbstractStandardBasicType<T>
-
- All Implemented Interfaces:
java.io.Serializable
,BasicType
,ProcedureParameterExtractionAware<T>
,ProcedureParameterNamedBinder
,StringRepresentableType<T>
,Type
- Direct Known Subclasses:
AbstractSingleColumnStandardBasicType
public abstract class AbstractStandardBasicType<T> extends java.lang.Object implements BasicType, StringRepresentableType<T>, ProcedureParameterExtractionAware<T>, ProcedureParameterNamedBinder
Convenience base class forBasicType
implementations- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AbstractStandardBasicType(SqlTypeDescriptor sqlTypeDescriptor, JavaTypeDescriptor<T> javaTypeDescriptor)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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 nameint
compare(java.lang.Object x, java.lang.Object y)
Perform aComparator
style comparison between valuesjava.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 noType.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 extractionT
extract(java.sql.CallableStatement statement, java.lang.String[] paramNames, SharedSessionContractImplementor session)
Perform the extractionT
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 toAnyType
.boolean
isAssociationType()
Return true if the implementation is castable toAssociationType
.boolean
isCollectionType()
Return true if the implementation is castable toCollectionType
.boolean
isComponentType()
Return true if the implementation is castable toCompositeType
.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 toEntityType
.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 theType.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 themapped 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 themapped 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 themapped 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 (perTypes
) 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.-
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, resolve
-
-
-
-
Constructor Detail
-
AbstractStandardBasicType
public AbstractStandardBasicType(SqlTypeDescriptor sqlTypeDescriptor, JavaTypeDescriptor<T> javaTypeDescriptor)
-
-
Method Detail
-
fromString
public T fromString(java.lang.String string)
-
toString
public java.lang.String toString(T value)
Description copied from interface:StringRepresentableType
Render the value to the string representation.- Specified by:
toString
in interfaceStringRepresentableType<T>
- Parameters:
value
- The value to render to string.- Returns:
- The string representation
-
fromStringValue
public T fromStringValue(java.lang.String xml) throws HibernateException
Description copied from interface:StringRepresentableType
Consume the given string representation back into this types java form.- Specified by:
fromStringValue
in interfaceStringRepresentableType<T>
- Parameters:
xml
- The string representation to be consumed.- Returns:
- The java type representation
- Throws:
HibernateException
- Problem consuming
-
getMutabilityPlan
protected MutabilityPlan<T> getMutabilityPlan()
-
getReplacement
protected T getReplacement(T original, T target, SharedSessionContractImplementor session)
-
toColumnNullness
public boolean[] toColumnNullness(java.lang.Object value, Mapping mapping)
Description copied from interface:Type
Given an instance of the type, return an array of boolean, indicating which mapped columns would be null.- Specified by:
toColumnNullness
in interfaceType
- Parameters:
value
- an instance of the typemapping
- The mapping abstraction- Returns:
- array indicating column nullness for a value instance
-
getRegistrationKeys
public java.lang.String[] getRegistrationKeys()
Description copied from interface:BasicType
Get the names under which this type should be registered in the type registry.- Specified by:
getRegistrationKeys
in interfaceBasicType
- Returns:
- The keys under which to register this type.
-
registerUnderJavaType
protected boolean registerUnderJavaType()
-
getDefaultSize
protected static Size getDefaultSize()
-
getDictatedSize
protected Size getDictatedSize()
-
getJavaTypeDescriptor
public final JavaTypeDescriptor<T> getJavaTypeDescriptor()
-
setJavaTypeDescriptor
public final void setJavaTypeDescriptor(JavaTypeDescriptor<T> javaTypeDescriptor)
-
getSqlTypeDescriptor
public final SqlTypeDescriptor getSqlTypeDescriptor()
-
setSqlTypeDescriptor
public final void setSqlTypeDescriptor(SqlTypeDescriptor sqlTypeDescriptor)
-
getReturnedClass
public final java.lang.Class getReturnedClass()
Description copied from interface:Type
The class returned byType.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.- Specified by:
getReturnedClass
in interfaceType
- Returns:
- The java type class handled by this type.
-
getColumnSpan
public final int getColumnSpan(Mapping mapping) throws MappingException
Description copied from interface:Type
How many columns are used to persist this type. Always the same assqlTypes(mapping).length
- Specified by:
getColumnSpan
in interfaceType
- Parameters:
mapping
- The mapping object :/- Returns:
- The number of columns
- Throws:
MappingException
- Generally indicates an issue accessing the passed mapping object.
-
sqlTypes
public final int[] sqlTypes(Mapping mapping) throws MappingException
Description copied from interface:Type
Return the JDBC types codes (perTypes
) for the columns mapped by this type. NOTE: The number of elements in this array matches the return fromType.getColumnSpan(org.hibernate.engine.spi.Mapping)
.- Specified by:
sqlTypes
in interfaceType
- Parameters:
mapping
- The mapping object :/- Returns:
- The JDBC type codes.
- Throws:
MappingException
- Generally indicates an issue accessing the passed mapping object.
-
dictatedSizes
public Size[] dictatedSizes(Mapping mapping) throws MappingException
Description copied from interface:Type
Return the column sizes dictated by this type. For example, the mapping for achar
/Character
would have a dictated length limit of 1; for a string-basedUUID
would have a size limit of 36; etc. NOTE: The number of elements in this array matches the return fromType.getColumnSpan(org.hibernate.engine.spi.Mapping)
.- Specified by:
dictatedSizes
in interfaceType
- Parameters:
mapping
- The mapping object :/- Returns:
- The dictated sizes.
- Throws:
MappingException
- Generally indicates an issue accessing the passed mapping object.
-
defaultSizes
public Size[] defaultSizes(Mapping mapping) throws MappingException
Description copied from interface:Type
Defines the column sizes to use according to this type if the user did not explicitly say (and if noType.dictatedSizes(org.hibernate.engine.spi.Mapping)
were given). NOTE: The number of elements in this array matches the return fromType.getColumnSpan(org.hibernate.engine.spi.Mapping)
.- Specified by:
defaultSizes
in interfaceType
- Parameters:
mapping
- The mapping object :/- Returns:
- The default sizes.
- Throws:
MappingException
- Generally indicates an issue accessing the passed mapping object.
-
isAssociationType
public final boolean isAssociationType()
Description copied from interface:Type
Return true if the implementation is castable toAssociationType
. This does not necessarily imply that the type actually represents an association. Essentially a polymorphic version of(type instanceof AssociationType.class)
- Specified by:
isAssociationType
in interfaceType
- Returns:
- True if this type is also an
AssociationType
implementor; false otherwise.
-
isCollectionType
public final boolean isCollectionType()
Description copied from interface:Type
Return true if the implementation is castable toCollectionType
. Essentially a polymorphic version of(type instanceof CollectionType.class)
ACollectionType
is additionally anAssociationType
; so if this method returns true,Type.isAssociationType()
should also return true.- Specified by:
isCollectionType
in interfaceType
- Returns:
- True if this type is also a
CollectionType
implementor; false otherwise.
-
isComponentType
public final boolean isComponentType()
Description copied from interface:Type
Return true if the implementation is castable toCompositeType
. Essentially a polymorphic version of(type instanceof CompositeType.class)
. A component type may own collections or associations and hence must provide certain extra functionality.- Specified by:
isComponentType
in interfaceType
- Returns:
- True if this type is also a
CompositeType
implementor; false otherwise.
-
isEntityType
public final boolean isEntityType()
Description copied from interface:Type
Return true if the implementation is castable toEntityType
. Essentially a polymorphic version of(type instanceof EntityType.class)
. AnEntityType
is additionally anAssociationType
; so if this method returns true,Type.isAssociationType()
should also return true.- Specified by:
isEntityType
in interfaceType
- Returns:
- True if this type is also an
EntityType
implementor; false otherwise.
-
isAnyType
public final boolean isAnyType()
Description copied from interface:Type
Return true if the implementation is castable toAnyType
. Essentially a polymorphic version of(type instanceof AnyType.class)
. AnAnyType
is additionally anAssociationType
; so if this method returns true,Type.isAssociationType()
should also return true.
-
isXMLElement
public final boolean isXMLElement()
-
isSame
public final boolean isSame(java.lang.Object x, java.lang.Object y)
Description copied from interface:Type
Compare two instances of the class mapped by this type for persistence "equality" (equality of persistent state) taking a shortcut for entity references. For most types this should equate to anequals
check on the values. For associations the implication is a bit different. For most types it is conceivable to simply delegate toType.isEqual(java.lang.Object, java.lang.Object)
-
isEqual
public final boolean isEqual(java.lang.Object x, java.lang.Object y, SessionFactoryImplementor factory)
Description copied from interface:Type
Compare two instances of the class mapped by this type for persistence "equality" (equality of persistent state). This should always equate to some form of comparison of the value's internal state. As an example, for something like a date the comparison should be based on its internal "time" state based on the specific portion it is meant to represent (timestamp, date, time).
-
isEqual
public final boolean isEqual(java.lang.Object one, java.lang.Object another)
Description copied from interface:Type
Compare two instances of the class mapped by this type for persistence "equality" (equality of persistent state). This should always equate to some form of comparison of the value's internal state. As an example, for something like a date the comparison should be based on its internal "time" state based on the specific portion it is meant to represent (timestamp, date, time).
-
getHashCode
public final int getHashCode(java.lang.Object x)
Description copied from interface:Type
Get a hash code, consistent with persistence "equality". Again for most types the normal usage is to delegate to the value'shashCode
.- Specified by:
getHashCode
in interfaceType
- Parameters:
x
- The value for which to retrieve a hash code- Returns:
- The hash code
-
getHashCode
public final int getHashCode(java.lang.Object x, SessionFactoryImplementor factory)
Description copied from interface:Type
Get a hash code, consistent with persistence "equality". Again for most types the normal usage is to delegate to the value'shashCode
.- Specified by:
getHashCode
in interfaceType
- Parameters:
x
- The value for which to retrieve a hash codefactory
- The session factory- Returns:
- The hash code
-
compare
public final int compare(java.lang.Object x, java.lang.Object y)
Description copied from interface:Type
Perform aComparator
style comparison between values
-
isDirty
public final boolean isDirty(java.lang.Object old, java.lang.Object current, SharedSessionContractImplementor session)
Description copied from interface:Type
Should the parent be considered dirty, given both the old and current value?
-
isDirty
public final boolean isDirty(java.lang.Object old, java.lang.Object current, boolean[] checkable, SharedSessionContractImplementor session)
Description copied from interface:Type
Should the parent be considered dirty, given both the old and current value?
-
isDirty
protected final boolean isDirty(java.lang.Object old, java.lang.Object current)
-
isModified
public final boolean isModified(java.lang.Object oldHydratedState, java.lang.Object currentState, boolean[] checkable, SharedSessionContractImplementor session)
Description copied from interface:Type
Has the value been modified compared to the current database state? The difference between this and theType.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 toType.isDirty(java.lang.Object, java.lang.Object, org.hibernate.engine.spi.SharedSessionContractImplementor)
here/- Specified by:
isModified
in interfaceType
- Parameters:
oldHydratedState
- 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.- Returns:
- true if the field has been modified
-
nullSafeGet
public final java.lang.Object nullSafeGet(java.sql.ResultSet rs, java.lang.String[] names, SharedSessionContractImplementor session, java.lang.Object owner) throws java.sql.SQLException
Description copied from interface:Type
Extract a value of themapped class
from the JDBC result set. Implementors should handle possibility of null values.- Specified by:
nullSafeGet
in interfaceType
- Parameters:
rs
- 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- Returns:
- The extracted value
- Throws:
java.sql.SQLException
- An error from the JDBC driver- See Also:
alternative, 2-phase property initialization
-
nullSafeGet
public final java.lang.Object nullSafeGet(java.sql.ResultSet rs, java.lang.String name, SharedSessionContractImplementor session, java.lang.Object owner) throws java.sql.SQLException
Description copied from interface:Type
Extract a value of themapped 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.- Specified by:
nullSafeGet
in interfaceType
- Parameters:
rs
- 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- Returns:
- The extracted value
- Throws:
java.sql.SQLException
- An error from the JDBC driver
-
nullSafeGet
public final T nullSafeGet(java.sql.ResultSet rs, java.lang.String name, SharedSessionContractImplementor session) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
nullSafeGet
protected final T nullSafeGet(java.sql.ResultSet rs, java.lang.String name, WrapperOptions options) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
get
public java.lang.Object get(java.sql.ResultSet rs, java.lang.String name, SharedSessionContractImplementor session) throws HibernateException, java.sql.SQLException
- Throws:
HibernateException
java.sql.SQLException
-
nullSafeSet
public final void nullSafeSet(java.sql.PreparedStatement st, java.lang.Object value, int index, SharedSessionContractImplementor session) throws java.sql.SQLException
Description copied from interface:Type
Bind a value represented by an instance of themapped class
to the JDBC prepared statement. Implementors should handle possibility of null values. A multi-column type should bind parameters starting from index.- Specified by:
nullSafeSet
in interfaceType
- Parameters:
st
- The JDBC prepared statement to which to bindvalue
- the object to writeindex
- starting parameter bind indexsession
- The originating session- Throws:
java.sql.SQLException
- An error from the JDBC driver
-
nullSafeSet
protected final void nullSafeSet(java.sql.PreparedStatement st, java.lang.Object value, int index, WrapperOptions options) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
remapSqlTypeDescriptor
protected SqlTypeDescriptor remapSqlTypeDescriptor(WrapperOptions options)
-
set
public void set(java.sql.PreparedStatement st, T value, int index, SharedSessionContractImplementor session) throws HibernateException, java.sql.SQLException
- Throws:
HibernateException
java.sql.SQLException
-
toLoggableString
public final java.lang.String toLoggableString(java.lang.Object value, SessionFactoryImplementor factory)
Description copied from interface:Type
Generate a representation of the value for logging purposes.- Specified by:
toLoggableString
in interfaceType
- Parameters:
value
- The value to be loggedfactory
- The session factory- Returns:
- The loggable representation
-
isMutable
public final boolean isMutable()
Description copied from interface:Type
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.)
-
deepCopy
public final java.lang.Object deepCopy(java.lang.Object value, SessionFactoryImplementor factory)
Description copied from interface:Type
Return a deep copy of the persistent state, stopping at entities and at collections.
-
disassemble
public final java.io.Serializable disassemble(java.lang.Object value, SharedSessionContractImplementor session, java.lang.Object owner) throws HibernateException
Description copied from interface:Type
Return a disassembled representation of the object. This is the value Hibernate will use in second level caching, so care should be taken to break values down to their simplest forms; for entities especially, this means breaking them down into their constituent parts.- Specified by:
disassemble
in interfaceType
- Parameters:
value
- the value to cachesession
- the originating sessionowner
- optional parent entity object (needed for collections)- Returns:
- the disassembled, deep cloned state
- Throws:
HibernateException
- An error from Hibernate
-
assemble
public final java.lang.Object assemble(java.io.Serializable cached, SharedSessionContractImplementor session, java.lang.Object owner) throws HibernateException
Description copied from interface:Type
Reconstruct the object from its disassembled state. This method is the reciprocal ofType.disassemble(java.lang.Object, org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object)
- Specified by:
assemble
in interfaceType
- Parameters:
cached
- the disassembled state from the cachesession
- the originating sessionowner
- the parent entity object- Returns:
- the (re)assembled object
- Throws:
HibernateException
- An error from Hibernate
-
beforeAssemble
public final void beforeAssemble(java.io.Serializable cached, SharedSessionContractImplementor session)
Description copied from interface:Type
Called before assembling a query result set from the query cache, to allow batch fetching of entities missing from the second-level cache.- Specified by:
beforeAssemble
in interfaceType
- Parameters:
cached
- The keysession
- The originating session
-
hydrate
public final java.lang.Object hydrate(java.sql.ResultSet rs, java.lang.String[] names, SharedSessionContractImplementor session, java.lang.Object owner) throws HibernateException, java.sql.SQLException
Description copied from interface:Type
Extract a value from the JDBC result set. This is useful for 2-phase property initialization - the second phase is a call toType.resolve(java.lang.Object, org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object)
This hydrated value will be either:- in the case of an entity or collection type, the key
- otherwise, the value itself
- Specified by:
hydrate
in interfaceType
- Parameters:
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 entity- Returns:
- An entity or collection key, or an actual value.
- Throws:
HibernateException
- An error from Hibernatejava.sql.SQLException
- An error from the JDBC driver- See Also:
Type.resolve(java.lang.Object, org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object)
-
resolve
public final java.lang.Object resolve(java.lang.Object value, SharedSessionContractImplementor session, java.lang.Object owner) throws HibernateException
- Specified by:
resolve
in interfaceType
- Throws:
HibernateException
- See Also:
Type.resolve(Object, SharedSessionContractImplementor, Object, Boolean)
-
semiResolve
public final java.lang.Object semiResolve(java.lang.Object value, SharedSessionContractImplementor session, java.lang.Object owner) throws HibernateException
Description copied from interface:Type
Given a hydrated, but unresolved value, return a value that may be used to reconstruct property-ref associations.- Specified by:
semiResolve
in interfaceType
- Parameters:
value
- The unresolved, hydrated valuesession
- THe originating sessionowner
- The value owner- Returns:
- The semi-resolved value
- Throws:
HibernateException
- An error from Hibernate
-
getSemiResolvedType
public final Type getSemiResolvedType(SessionFactoryImplementor factory)
Description copied from interface:Type
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. The main deviation from this is in the case of an entity where the type would be the entity type and semi-resolved type would be its identifier type- Specified by:
getSemiResolvedType
in interfaceType
- Parameters:
factory
- The session factory- Returns:
- The semi-resolved type
-
replace
public final java.lang.Object replace(java.lang.Object original, java.lang.Object target, SharedSessionContractImplementor session, java.lang.Object owner, java.util.Map copyCache)
Description copied from interface:Type
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.- Specified by:
replace
in interfaceType
- Parameters:
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 values- Returns:
- the value to be merged
-
replace
public java.lang.Object replace(java.lang.Object original, java.lang.Object target, SharedSessionContractImplementor session, java.lang.Object owner, java.util.Map copyCache, ForeignKeyDirection foreignKeyDirection)
Description copied from interface:Type
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.- Specified by:
replace
in interfaceType
- Parameters:
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?- Returns:
- the value to be merged
-
canDoExtraction
public boolean canDoExtraction()
Description copied from interface:ProcedureParameterExtractionAware
Can the given instance of this type actually perform the parameter value extractions?- Specified by:
canDoExtraction
in interfaceProcedureParameterExtractionAware<T>
- Returns:
true
indicates that @{link #extract} calls will not fail due toIllegalStateException
.
-
extract
public T extract(java.sql.CallableStatement statement, int startIndex, SharedSessionContractImplementor session) throws java.sql.SQLException
Description copied from interface:ProcedureParameterExtractionAware
Perform the extraction- Specified by:
extract
in interfaceProcedureParameterExtractionAware<T>
- Parameters:
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 session- Returns:
- The extracted value.
- Throws:
java.sql.SQLException
- Indicates an issue calling into the CallableStatement
-
extract
public T extract(java.sql.CallableStatement statement, java.lang.String[] paramNames, SharedSessionContractImplementor session) throws java.sql.SQLException
Description copied from interface:ProcedureParameterExtractionAware
Perform the extraction- Specified by:
extract
in interfaceProcedureParameterExtractionAware<T>
- Parameters:
statement
- The CallableStatement from which to extract the parameter value(s).paramNames
- The parameter names.session
- The originating session- Returns:
- The extracted value.
- Throws:
java.sql.SQLException
- Indicates an issue calling into the CallableStatement
-
nullSafeSet
public void nullSafeSet(java.sql.CallableStatement st, java.lang.Object value, java.lang.String name, SharedSessionContractImplementor session) throws java.sql.SQLException
Description copied from interface:ProcedureParameterNamedBinder
Bind a value to the JDBC prepared statement, ignoring some columns as dictated by the 'settable' parameter. Implementors should handle the possibility of null values. Does not support multi-column type- Specified by:
nullSafeSet
in interfaceProcedureParameterNamedBinder
- Parameters:
st
- The CallableStatement to which to bindvalue
- the object to writename
- parameter bind namesession
- The originating session- Throws:
java.sql.SQLException
- An error from the JDBC driver
-
nullSafeSet
protected final void nullSafeSet(java.sql.CallableStatement st, java.lang.Object value, java.lang.String name, WrapperOptions options) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
canDoSetting
public boolean canDoSetting()
Description copied from interface:ProcedureParameterNamedBinder
Can the given instance of this type actually set the parameter value by name- Specified by:
canDoSetting
in interfaceProcedureParameterNamedBinder
- Returns:
true
indicates that @{link #nullSafeSet} calls will not fail
-
-