站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Hibernate 2.1.8 正式版 API 英文文档

OneToOneType (Hibernate API Documentation) - Hibernate 2.1.8 正式版 API 英文文档


net.sf.hibernate.type
Class OneToOneType

java.lang.Object
  extended bynet.sf.hibernate.type.AbstractType
      extended bynet.sf.hibernate.type.EntityType
          extended bynet.sf.hibernate.type.OneToOneType
All Implemented Interfaces:
AssociationType, Serializable, Type

public class OneToOneType
extends EntityType

A one-to-one association to an entity

Author:
Gavin King
See Also:
Serialized Form

Field Summary
 
Fields inherited from class net.sf.hibernate.type.EntityType
uniqueKeyPropertyName
 
Constructor Summary
OneToOneType(Class persistentClass, ForeignKeyDirection foreignKeyType, String uniqueKeyPropertyName)
           
 
Method Summary
 Object assemble(Serializable oid, SessionImplementor session, Object owner)
          Reconstruct the object from its cached "disassembled" state.
 Serializable disassemble(Object value, SessionImplementor session)
          Return a cacheable "disassembled" representation of the object.
 int getColumnSpan(Mapping session)
          How many columns are used to persist this type.
 ForeignKeyDirection getForeignKeyDirection()
          Get the foreign key directionality of this association
 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.
 boolean isDirty(Object old, Object current, SessionImplementor session)
          Should the parent be considered dirty, given both the old and current field or element value?
 boolean isModified(Object old, Object current, SessionImplementor session)
          Has the parent object been modified, compared to the current database state?
 boolean isNullable()
           
 boolean isOneToOne()
           
 void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session)
          Write an instance of the mapped class to a prepared statement.
protected  Object resolveIdentifier(Serializable id, SessionImplementor session)
          Resolve an identifier
 int[] sqlTypes(Mapping session)
          Return the SQL type codes for the columns mapped by this type.
 boolean usePrimaryKeyAsForeignKey()
          Is the foreign key the primary key of the table?
 
Methods inherited from class net.sf.hibernate.type.EntityType
copy, deepCopy, equals, equals, fromString, getAssociatedClass, getAssociatedClass, getIdentifier, getIdentifierOrUniqueKeyPropertyName, getIdentifierOrUniqueKeyType, getJoinable, getName, getPersistentClass, getReferencedColumns, getReturnedClass, hashCode, hasNiceEquals, isAssociationType, isEntityType, isMutable, isUniqueKeyReference, nullSafeGet, nullSafeGet, resolveIdentifier, toString
 
Methods inherited from class net.sf.hibernate.type.AbstractType
isComponentType, isObjectType, isPersistentCollectionType
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.hibernate.type.Type
isComponentType, isObjectType, isPersistentCollectionType
 

Constructor Detail

OneToOneType

public OneToOneType(Class persistentClass,
                    ForeignKeyDirection foreignKeyType,
                    String uniqueKeyPropertyName)
Method Detail

getColumnSpan

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

Throws:
MappingException

sqlTypes

public int[] sqlTypes(Mapping session)
               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.

Returns:
the typecodes
Throws:
MappingException
See Also:
Types

nullSafeSet

public void nullSafeSet(PreparedStatement st,
                        Object value,
                        int index,
                        SessionImplementor session)
                 throws HibernateException,
                        SQLException
Description copied from interface: Type
Write an instance of the mapped class to a prepared statement. Implementors should handle possibility of null values. A multi-column type should be written to parameters starting from index.

Parameters:
st -
value - the object to write
index - statement parameter index
session -
Throws:
SQLException
HibernateException

isOneToOne

public boolean isOneToOne()
Specified by:
isOneToOne in class EntityType

isDirty

public boolean isDirty(Object old,
                       Object current,
                       SessionImplementor session)
                throws HibernateException
Description copied from interface: Type
Should the parent be considered dirty, given both the old and current field or element value?

Specified by:
isDirty in interface Type
Overrides:
isDirty in class EntityType
Throws:
HibernateException

isModified

public boolean isModified(Object old,
                          Object current,
                          SessionImplementor session)
                   throws HibernateException
Description copied from interface: Type
Has the parent object been modified, compared to the current database state?

Specified by:
isModified in interface Type
Overrides:
isModified in class AbstractType
Throws:
HibernateException

getForeignKeyDirection

public ForeignKeyDirection getForeignKeyDirection()
Description copied from interface: AssociationType
Get the foreign key directionality of this association


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
Specified by:
hydrate in class EntityType
Throws:
HibernateException
SQLException

resolveIdentifier

protected Object resolveIdentifier(Serializable id,
                                   SessionImplementor session)
                            throws HibernateException
Description copied from class: EntityType
Resolve an identifier

Specified by:
resolveIdentifier in class EntityType
Throws:
HibernateException

isNullable

public boolean isNullable()

usePrimaryKeyAsForeignKey

public boolean usePrimaryKeyAsForeignKey()
Description copied from interface: AssociationType
Is the foreign key the primary key of the table?


disassemble

public Serializable disassemble(Object value,
                                SessionImplementor session)
                         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 AbstractType
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 AbstractType
Throws:
HibernateException