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 forBasicTypeimplementations- 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.Objectassemble(java.io.Serializable cached, SharedSessionContractImplementor session, java.lang.Object owner)Reconstruct the object from its disassembled state.voidbeforeAssemble(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.booleancanDoExtraction()Can the given instance of this type actually perform the parameter value extractions?booleancanDoSetting()Can the given instance of this type actually set the parameter value by nameintcompare(java.lang.Object x, java.lang.Object y)Perform aComparatorstyle comparison between valuesjava.lang.ObjectdeepCopy(java.lang.Object value, SessionFactoryImplementor factory)Return a deep copy of the persistent state, stopping at entities and at collections.protected TdeepCopy(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.Serializabledisassemble(java.lang.Object value, SharedSessionContractImplementor session, java.lang.Object owner)Return a disassembled representation of the object.Textract(java.sql.CallableStatement statement, int startIndex, SharedSessionContractImplementor session)Perform the extractionTextract(java.sql.CallableStatement statement, java.lang.String[] paramNames, SharedSessionContractImplementor session)Perform the extractionTfromString(java.lang.String string)TfromStringValue(java.lang.String xml)Consume the given string representation back into this types java form.java.lang.Objectget(java.sql.ResultSet rs, java.lang.String name, SharedSessionContractImplementor session)intgetColumnSpan(Mapping mapping)How many columns are used to persist this type.protected static SizegetDefaultSize()protected SizegetDictatedSize()intgetHashCode(java.lang.Object x)Get a hash code, consistent with persistence "equality".intgetHashCode(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 TgetReplacement(T original, T target, SharedSessionContractImplementor session)java.lang.ClassgetReturnedClass()TypegetSemiResolvedType(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.SqlTypeDescriptorgetSqlTypeDescriptor()java.lang.Objecthydrate(java.sql.ResultSet rs, java.lang.String[] names, SharedSessionContractImplementor session, java.lang.Object owner)Extract a value from the JDBC result set.booleanisAnyType()Return true if the implementation is castable toAnyType.booleanisAssociationType()Return true if the implementation is castable toAssociationType.booleanisCollectionType()Return true if the implementation is castable toCollectionType.booleanisComponentType()Return true if the implementation is castable toCompositeType.protected booleanisDirty(java.lang.Object old, java.lang.Object current)booleanisDirty(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?booleanisDirty(java.lang.Object old, java.lang.Object current, SharedSessionContractImplementor session)Should the parent be considered dirty, given both the old and current value?booleanisEntityType()Return true if the implementation is castable toEntityType.booleanisEqual(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).booleanisEqual(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).booleanisModified(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.booleanisMutable()Are objects of this type mutable.booleanisSame(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.booleanisXMLElement()java.lang.ObjectnullSafeGet(java.sql.ResultSet rs, java.lang.String[] names, SharedSessionContractImplementor session, java.lang.Object owner)Extract a value of themapped classfrom the JDBC result set.TnullSafeGet(java.sql.ResultSet rs, java.lang.String name, SharedSessionContractImplementor session)java.lang.ObjectnullSafeGet(java.sql.ResultSet rs, java.lang.String name, SharedSessionContractImplementor session, java.lang.Object owner)Extract a value of themapped classfrom the JDBC result set.protected TnullSafeGet(java.sql.ResultSet rs, java.lang.String name, WrapperOptions options)voidnullSafeSet(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 voidnullSafeSet(java.sql.CallableStatement st, java.lang.Object value, java.lang.String name, WrapperOptions options)voidnullSafeSet(java.sql.PreparedStatement st, java.lang.Object value, int index, SharedSessionContractImplementor session)Bind a value represented by an instance of themapped classto the JDBC prepared statement.protected voidnullSafeSet(java.sql.PreparedStatement st, java.lang.Object value, int index, WrapperOptions options)protected booleanregisterUnderJavaType()protected SqlTypeDescriptorremapSqlTypeDescriptor(WrapperOptions options)java.lang.Objectreplace(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.Objectreplace(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.Objectresolve(java.lang.Object value, SharedSessionContractImplementor session, java.lang.Object owner)java.lang.ObjectsemiResolve(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.voidset(java.sql.PreparedStatement st, T value, int index, SharedSessionContractImplementor session)voidsetJavaTypeDescriptor(JavaTypeDescriptor<T> javaTypeDescriptor)voidsetSqlTypeDescriptor(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.StringtoLoggableString(java.lang.Object value, SessionFactoryImplementor factory)Generate a representation of the value for logging purposes.java.lang.StringtoString(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:StringRepresentableTypeRender the value to the string representation.- Specified by:
toStringin 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:StringRepresentableTypeConsume the given string representation back into this types java form.- Specified by:
fromStringValuein 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:TypeGiven an instance of the type, return an array of boolean, indicating which mapped columns would be null.- Specified by:
toColumnNullnessin 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:BasicTypeGet the names under which this type should be registered in the type registry.- Specified by:
getRegistrationKeysin 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:TypeThe 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:
getReturnedClassin interfaceType- Returns:
- The java type class handled by this type.
-
getColumnSpan
public final int getColumnSpan(Mapping mapping) throws MappingException
Description copied from interface:TypeHow many columns are used to persist this type. Always the same assqlTypes(mapping).length- Specified by:
getColumnSpanin 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:TypeReturn 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:
sqlTypesin 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:TypeReturn the column sizes dictated by this type. For example, the mapping for achar/Characterwould have a dictated length limit of 1; for a string-basedUUIDwould 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:
dictatedSizesin 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:TypeDefines 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:
defaultSizesin 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:TypeReturn 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:
isAssociationTypein interfaceType- Returns:
- True if this type is also an
AssociationTypeimplementor; false otherwise.
-
isCollectionType
public final boolean isCollectionType()
Description copied from interface:TypeReturn true if the implementation is castable toCollectionType. Essentially a polymorphic version of(type instanceof CollectionType.class)ACollectionTypeis additionally anAssociationType; so if this method returns true,Type.isAssociationType()should also return true.- Specified by:
isCollectionTypein interfaceType- Returns:
- True if this type is also a
CollectionTypeimplementor; false otherwise.
-
isComponentType
public final boolean isComponentType()
Description copied from interface:TypeReturn 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:
isComponentTypein interfaceType- Returns:
- True if this type is also a
CompositeTypeimplementor; false otherwise.
-
isEntityType
public final boolean isEntityType()
Description copied from interface:TypeReturn true if the implementation is castable toEntityType. Essentially a polymorphic version of(type instanceof EntityType.class). AnEntityTypeis additionally anAssociationType; so if this method returns true,Type.isAssociationType()should also return true.- Specified by:
isEntityTypein interfaceType- Returns:
- True if this type is also an
EntityTypeimplementor; false otherwise.
-
isAnyType
public final boolean isAnyType()
Description copied from interface:TypeReturn true if the implementation is castable toAnyType. Essentially a polymorphic version of(type instanceof AnyType.class). AnAnyTypeis 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:TypeCompare 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 anequalscheck 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:TypeCompare 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:TypeCompare 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:TypeGet a hash code, consistent with persistence "equality". Again for most types the normal usage is to delegate to the value'shashCode.- Specified by:
getHashCodein 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:TypeGet a hash code, consistent with persistence "equality". Again for most types the normal usage is to delegate to the value'shashCode.- Specified by:
getHashCodein 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:TypePerform aComparatorstyle comparison between values
-
isDirty
public final boolean isDirty(java.lang.Object old, java.lang.Object current, SharedSessionContractImplementor session)Description copied from interface:TypeShould 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:TypeShould 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:TypeHas 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:
isModifiedin interfaceType- Parameters:
oldHydratedState- the database state, in a "hydrated" form, with identifiers unresolvedcurrentState- the current state of the objectcheckable- which columns are actually checkablesession- 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.SQLExceptionDescription copied from interface:TypeExtract a value of themapped classfrom the JDBC result set. Implementors should handle possibility of null values.- Specified by:
nullSafeGetin 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.SQLExceptionDescription copied from interface:TypeExtract a value of themapped classfrom 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:
nullSafeGetin 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:
HibernateExceptionjava.sql.SQLException
-
nullSafeSet
public final void nullSafeSet(java.sql.PreparedStatement st, java.lang.Object value, int index, SharedSessionContractImplementor session) throws java.sql.SQLExceptionDescription copied from interface:TypeBind a value represented by an instance of themapped classto the JDBC prepared statement. Implementors should handle possibility of null values. A multi-column type should bind parameters starting from index.- Specified by:
nullSafeSetin 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:
HibernateExceptionjava.sql.SQLException
-
toLoggableString
public final java.lang.String toLoggableString(java.lang.Object value, SessionFactoryImplementor factory)Description copied from interface:TypeGenerate a representation of the value for logging purposes.- Specified by:
toLoggableStringin interfaceType- Parameters:
value- The value to be loggedfactory- The session factory- Returns:
- The loggable representation
-
isMutable
public final boolean isMutable()
Description copied from interface:TypeAre 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:TypeReturn 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 HibernateExceptionDescription copied from interface:TypeReturn 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:
disassemblein 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 HibernateExceptionDescription copied from interface:TypeReconstruct 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:
assemblein 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:TypeCalled before assembling a query result set from the query cache, to allow batch fetching of entities missing from the second-level cache.- Specified by:
beforeAssemblein 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.SQLExceptionDescription copied from interface:TypeExtract 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:
hydratein 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:
resolvein 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 HibernateExceptionDescription copied from interface:TypeGiven a hydrated, but unresolved value, return a value that may be used to reconstruct property-ref associations.- Specified by:
semiResolvein 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:TypeAs 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:
getSemiResolvedTypein 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:TypeDuring 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:
replacein 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:TypeDuring 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:
replacein 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:ProcedureParameterExtractionAwareCan the given instance of this type actually perform the parameter value extractions?- Specified by:
canDoExtractionin interfaceProcedureParameterExtractionAware<T>- Returns:
trueindicates 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:ProcedureParameterExtractionAwarePerform the extraction- Specified by:
extractin 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:ProcedureParameterExtractionAwarePerform the extraction- Specified by:
extractin 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.SQLExceptionDescription copied from interface:ProcedureParameterNamedBinderBind 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:
nullSafeSetin 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:ProcedureParameterNamedBinderCan the given instance of this type actually set the parameter value by name- Specified by:
canDoSettingin interfaceProcedureParameterNamedBinder- Returns:
trueindicates that @{link #nullSafeSet} calls will not fail
-
-