org.hibernate.type
Class SpecialOneToOneType

java.lang.Object
  extended by org.hibernate.type.AbstractType
      extended by org.hibernate.type.EntityType
          extended by org.hibernate.type.OneToOneType
              extended by org.hibernate.type.SpecialOneToOneType
All Implemented Interfaces:
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.

Author:
Gavin King
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.hibernate.type.EntityType
isEmbeddedInXML, uniqueKeyPropertyName
 
Constructor Summary
SpecialOneToOneType(String referencedEntityName, ForeignKeyDirection foreignKeyType, String uniqueKeyPropertyName, boolean lazy, boolean unwrapProxy, String entityName, String propertyName)
           
 
Method Summary
 Object assemble(Serializable oid, SessionImplementor session, Object owner)
          Reconstruct the object from its cached "disassembled" state.
 Serializable disassemble(Object value, SessionImplementor session, Object owner)
          Return a cacheable "disassembled" representation of the object.
 int getColumnSpan(Mapping mapping)
          How many columns are used to persist this type.
 Object hydrate(ResultSet rs, String[] names, SessionImplementor session, Object owner)
          Retrieve an instance of the mapped class, or the identifier of an entity or collection, from a JDBC resultset.
 int[] sqlTypes(Mapping mapping)
          Return the SQL type codes 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, nullSafeSet, toColumnNullness
 
Methods inherited from class org.hibernate.type.EntityType
compare, deepCopy, fromXMLNode, getAssociatedEntityName, getAssociatedEntityName, getAssociatedJoinable, getHashCode, getIdentifier, getIdentifierOrUniqueKeyPropertyName, getIdentifierOrUniqueKeyType, getLHSPropertyName, getName, getOnCondition, getReturnedClass, getRHSUniqueKeyPropertyName, getSemiResolvedType, isAssociationType, isEmbeddedInXML, isEntityType, isEqual, isLogicalOneToOne, isMutable, isNotEmbedded, isReferenceToPrimaryKey, isSame, isXMLElement, loadByUniqueKey, nullSafeGet, nullSafeGet, replace, resolve, resolveIdentifier, setToXMLNode, toLoggableString, toString
 
Methods inherited from class org.hibernate.type.AbstractType
beforeAssemble, getHashCode, isAnyType, isCollectionType, isComponentType, isEqual, replace, replaceNode, 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

public SpecialOneToOneType(String referencedEntityName,
                           ForeignKeyDirection foreignKeyType,
                           String uniqueKeyPropertyName,
                           boolean lazy,
                           boolean unwrapProxy,
                           String entityName,
                           String propertyName)
Method Detail

getColumnSpan

public int getColumnSpan(Mapping mapping)
                  throws MappingException
Description copied from interface: Type
How many columns are used to persist this type.

Specified by:
getColumnSpan in interface Type
Overrides:
getColumnSpan in class OneToOneType
Throws:
MappingException

sqlTypes

public int[] sqlTypes(Mapping mapping)
               throws MappingException
Description copied from interface: Type
Return the SQL type codes for the columns mapped by this type. The codes are defined on java.sql.Types.

Specified by:
sqlTypes in interface Type
Overrides:
sqlTypes in class OneToOneType
Returns:
the typecodes
Throws:
MappingException
See Also:
Types

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 interface AssociationType
Overrides:
useLHSPrimaryKey in class OneToOneType

hydrate

public Object hydrate(ResultSet rs,
                      String[] names,
                      SessionImplementor session,
                      Object owner)
               throws HibernateException,
                      SQLException
Description copied from interface: Type
Retrieve an instance of the mapped class, or the identifier of an entity or collection, from a JDBC resultset. This is useful for 2-phase property initialization - the second phase is a call to resolveIdentifier().

Specified by:
hydrate in interface Type
Overrides:
hydrate in class OneToOneType
names - the column names
session - the session
owner - the parent entity
Returns:
Object an identifier or actual value
Throws:
HibernateException
SQLException
See Also:
Type.resolve(Object, SessionImplementor, Object)

disassemble

public Serializable disassemble(Object value,
                                SessionImplementor session,
                                Object owner)
                         throws HibernateException
Description copied from interface: Type
Return a cacheable "disassembled" representation of the object.

Specified by:
disassemble in interface Type
Overrides:
disassemble in class OneToOneType
Parameters:
value - the value to cache
session - the session
owner - optional parent entity object (needed for collections)
Returns:
the disassembled, deep cloned state
Throws:
HibernateException

assemble

public Object assemble(Serializable oid,
                       SessionImplementor session,
                       Object owner)
                throws HibernateException
Description copied from interface: Type
Reconstruct the object from its cached "disassembled" state.

Specified by:
assemble in interface Type
Overrides:
assemble in class OneToOneType
Parameters:
oid - the disassembled state from the cache
session - the session
owner - the parent entity object
Returns:
the the object
Throws:
HibernateException


Copyright © 2001-2010 Red Hat, Inc. All Rights Reserved.