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

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


net.sf.hibernate.type
Class NullableType

java.lang.Object
  extended bynet.sf.hibernate.type.AbstractType
      extended bynet.sf.hibernate.type.NullableType
All Implemented Interfaces:
Serializable, Type
Direct Known Subclasses:
ImmutableType, MutableType

public abstract class NullableType
extends AbstractType

Superclass of single-column nullable types.

Author:
Gavin King
See Also:
Serialized Form

Constructor Summary
NullableType()
           
 
Method Summary
 Object deepCopy(Object value)
          Return a deep copy of the persistent state, stopping at entities and at collections.
abstract  Object deepCopyNotNull(Object value)
           
 Object fromString(String xml)
          Parse the XML representation of an instance.
abstract  Object fromStringValue(String xml)
           
abstract  Object get(ResultSet rs, String name)
           
 int getColumnSpan(Mapping session)
          How many columns are used to persist this type.
 Object nullSafeGet(ResultSet rs, String name)
           
 Object nullSafeGet(ResultSet rs, String[] names)
           
 Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner)
          Retrieve an instance of the mapped class from a JDBC resultset.
 Object nullSafeGet(ResultSet rs, String name, SessionImplementor session, Object owner)
          Retrieve an instance of the mapped class from a JDBC resultset.
 void nullSafeSet(PreparedStatement st, Object value, int index)
           
 void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session)
          Write an instance of the mapped class to a prepared statement.
abstract  void set(PreparedStatement st, Object value, int index)
           
abstract  int sqlType()
           
 int[] sqlTypes(Mapping session)
          Return the SQL type codes for the columns mapped by this type.
abstract  String toString(Object value)
           
 String toString(Object value, SessionFactoryImplementor pc)
          A representation of the value to be embedded in an XML element.
 
Methods inherited from class net.sf.hibernate.type.AbstractType
assemble, copy, disassemble, equals, hashCode, hydrate, isAssociationType, isComponentType, isDirty, isEntityType, isModified, isObjectType, isPersistentCollectionType, resolveIdentifier
 
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
equals, getName, getReturnedClass, hasNiceEquals, isMutable
 

Constructor Detail

NullableType

public NullableType()
Method Detail

get

public abstract Object get(ResultSet rs,
                           String name)
                    throws HibernateException,
                           SQLException
Throws:
HibernateException
SQLException

set

public abstract void set(PreparedStatement st,
                         Object value,
                         int index)
                  throws HibernateException,
                         SQLException
Throws:
HibernateException
SQLException

sqlType

public abstract int sqlType()

toString

public abstract String toString(Object value)
                         throws HibernateException
Throws:
HibernateException

fromStringValue

public abstract Object fromStringValue(String xml)
                                throws HibernateException
Throws:
HibernateException

nullSafeSet

public final 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

nullSafeSet

public final void nullSafeSet(PreparedStatement st,
                              Object value,
                              int index)
                       throws HibernateException,
                              SQLException
Throws:
HibernateException
SQLException

nullSafeGet

public final Object nullSafeGet(ResultSet rs,
                                String[] names,
                                SessionImplementor session,
                                Object owner)
                         throws HibernateException,
                                SQLException
Description copied from interface: Type
Retrieve an instance of the mapped class from a JDBC resultset. Implementors should handle possibility of null values.

Parameters:
rs -
names - the column names
session -
owner - the parent entity
Returns:
Object
Throws:
HibernateException
SQLException
See Also:
alternative, 2-phase property initialization

nullSafeGet

public final Object nullSafeGet(ResultSet rs,
                                String[] names)
                         throws HibernateException,
                                SQLException
Throws:
HibernateException
SQLException

nullSafeGet

public final Object nullSafeGet(ResultSet rs,
                                String name)
                         throws HibernateException,
                                SQLException
Throws:
HibernateException
SQLException

nullSafeGet

public final Object nullSafeGet(ResultSet rs,
                                String name,
                                SessionImplementor session,
                                Object owner)
                         throws HibernateException,
                                SQLException
Description copied from interface: Type
Retrieve an instance of the mapped class from a JDBC resultset. Implementations should handle possibility of null values. This method might be called if the type is known to be a single-column type.

Parameters:
rs -
name - the column name
session -
owner - the parent entity
Returns:
Object
Throws:
SQLException
HibernateException

toString

public final String toString(Object value,
                             SessionFactoryImplementor pc)
                      throws HibernateException
Description copied from interface: Type
A representation of the value to be embedded in an XML element.

Parameters:
value -
pc -
Returns:
String
Throws:
HibernateException

fromString

public final Object fromString(String xml)
                        throws HibernateException
Description copied from interface: Type
Parse the XML representation of an instance.

Parameters:
xml -
Returns:
an instance of the type
Throws:
HibernateException

getColumnSpan

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


sqlTypes

public final int[] sqlTypes(Mapping session)
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
See Also:
Types

deepCopyNotNull

public abstract Object deepCopyNotNull(Object value)
                                throws HibernateException
Throws:
HibernateException

deepCopy

public final Object deepCopy(Object value)
                      throws HibernateException
Description copied from interface: Type
Return a deep copy of the persistent state, stopping at entities and at collections.

Parameters:
value - generally a collection element or entity field
Returns:
Object a copy
Throws:
HibernateException