Package org.hibernate.type
Class SpecialOneToOneType
- java.lang.Object
-
- org.hibernate.type.AbstractType
-
- org.hibernate.type.EntityType
-
- org.hibernate.type.OneToOneType
-
- org.hibernate.type.SpecialOneToOneType
-
- All Implemented Interfaces:
java.io.Serializable
,AssociationType
,Type
public class SpecialOneToOneType extends OneToOneType
A one-to-one association that maps to specific formula(s) instead of the primary key column of the owning entity.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.hibernate.type.EntityType
uniqueKeyPropertyName
-
Fields inherited from class org.hibernate.type.AbstractType
LEGACY_DEFAULT_SIZE, LEGACY_DICTATED_SIZE
-
-
Constructor Summary
Constructors Constructor Description SpecialOneToOneType(SpecialOneToOneType original, java.lang.String superTypeEntityName)
SpecialOneToOneType(TypeFactory.TypeScope scope, java.lang.String referencedEntityName, ForeignKeyDirection foreignKeyType, boolean referenceToPrimaryKey, java.lang.String uniqueKeyPropertyName, boolean lazy, boolean unwrapProxy, java.lang.String entityName, java.lang.String propertyName)
SpecialOneToOneType(TypeFactory.TypeScope scope, java.lang.String referencedEntityName, ForeignKeyDirection foreignKeyType, boolean referenceToPrimaryKey, java.lang.String uniqueKeyPropertyName, boolean lazy, boolean unwrapProxy, java.lang.String entityName, java.lang.String propertyName, boolean constrained)
SpecialOneToOneType(TypeFactory.TypeScope scope, java.lang.String referencedEntityName, ForeignKeyDirection foreignKeyType, java.lang.String uniqueKeyPropertyName, boolean lazy, boolean unwrapProxy, java.lang.String entityName, java.lang.String propertyName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
assemble(java.io.Serializable oid, SharedSessionContractImplementor session, java.lang.Object owner)
Reconstruct the object from its disassembled state.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.int
getColumnSpan(Mapping mapping)
How many columns are used to persist this type.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.int[]
sqlTypes(Mapping mapping)
Return the JDBC types codes (perTypes
) for the columns mapped by this type.boolean
useLHSPrimaryKey()
Is the primary key of the owning entity table to be used in the join?-
Methods inherited from class org.hibernate.type.OneToOneType
getForeignKeyDirection, getPropertyName, isAlwaysDirtyChecked, isDirty, isDirty, isModified, isNull, isNullable, isOneToOne, nullSafeSet, toColumnNullness
-
Methods inherited from class org.hibernate.type.EntityType
compare, deepCopy, getAssociatedEntityName, getAssociatedEntityName, getAssociatedEntityPersister, getAssociatedJoinable, getHashCode, getIdentifier, getIdentifierOrUniqueKeyPropertyName, getIdentifierOrUniqueKeyType, getLHSPropertyName, getName, getOnCondition, getOnCondition, getReturnedClass, getRHSUniqueKeyPropertyName, getSemiResolvedType, isAssociationType, isEntityType, isEqual, isLogicalOneToOne, isMutable, isReferenceToPrimaryKey, isSame, loadByUniqueKey, nullSafeGet, nullSafeGet, nullSafeSet, replace, requireIdentifierOrUniqueKeyType, resolve, resolve, resolveIdentifier, resolveIdentifier, scope, toLoggableString, toString
-
Methods inherited from class org.hibernate.type.AbstractType
beforeAssemble, getHashCode, isAnyType, isCollectionType, isComponentType, isEqual, replace, semiResolve
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.hibernate.type.Type
beforeAssemble, getHashCode, isAnyType, isCollectionType, isComponentType, isEqual, replace, semiResolve
-
-
-
-
Constructor Detail
-
SpecialOneToOneType
@Deprecated public SpecialOneToOneType(TypeFactory.TypeScope scope, java.lang.String referencedEntityName, ForeignKeyDirection foreignKeyType, java.lang.String uniqueKeyPropertyName, boolean lazy, boolean unwrapProxy, java.lang.String entityName, java.lang.String propertyName)
-
SpecialOneToOneType
@Deprecated public SpecialOneToOneType(TypeFactory.TypeScope scope, java.lang.String referencedEntityName, ForeignKeyDirection foreignKeyType, boolean referenceToPrimaryKey, java.lang.String uniqueKeyPropertyName, boolean lazy, boolean unwrapProxy, java.lang.String entityName, java.lang.String propertyName)
-
SpecialOneToOneType
public SpecialOneToOneType(TypeFactory.TypeScope scope, java.lang.String referencedEntityName, ForeignKeyDirection foreignKeyType, boolean referenceToPrimaryKey, java.lang.String uniqueKeyPropertyName, boolean lazy, boolean unwrapProxy, java.lang.String entityName, java.lang.String propertyName, boolean constrained)
-
SpecialOneToOneType
public SpecialOneToOneType(SpecialOneToOneType original, java.lang.String superTypeEntityName)
-
-
Method Detail
-
getColumnSpan
public 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
- Overrides:
getColumnSpan
in classOneToOneType
- Parameters:
mapping
- The mapping object :/- Returns:
- The number of columns
- Throws:
MappingException
- Generally indicates an issue accessing the passed mapping object.
-
sqlTypes
public 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
- Overrides:
sqlTypes
in classOneToOneType
- 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
- Overrides:
dictatedSizes
in classOneToOneType
- 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
- Overrides:
defaultSizes
in classOneToOneType
- Parameters:
mapping
- The mapping object :/- Returns:
- The default sizes.
- Throws:
MappingException
- Generally indicates an issue accessing the passed mapping object.
-
useLHSPrimaryKey
public boolean useLHSPrimaryKey()
Description copied from interface:AssociationType
Is the primary key of the owning entity table to be used in the join?- Specified by:
useLHSPrimaryKey
in interfaceAssociationType
- Overrides:
useLHSPrimaryKey
in classOneToOneType
-
hydrate
public 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
- Overrides:
hydrate
in classOneToOneType
- 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)
-
disassemble
public 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
- Overrides:
disassemble
in classOneToOneType
- 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 java.lang.Object assemble(java.io.Serializable oid, 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
- Overrides:
assemble
in classOneToOneType
- Parameters:
oid
- the disassembled state from the cachesession
- the originating sessionowner
- the parent entity object- Returns:
- the (re)assembled object
- Throws:
HibernateException
- An error from Hibernate
-
-