org.hibernate.type
Class ManyToOneType

java.lang.Object
  extended byorg.hibernate.type.AbstractType
      extended byorg.hibernate.type.EntityType
          extended byorg.hibernate.type.ManyToOneType
All Implemented Interfaces:
AssociationType, Serializable, Type

public class ManyToOneType
extends EntityType

A many-to-one association to an entity

Author:
Gavin King
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.hibernate.type.EntityType
isEmbeddedInXML, uniqueKeyPropertyName
 
Constructor Summary
ManyToOneType(String className)
           
ManyToOneType(String className, boolean lazy)
           
ManyToOneType(String className, String uniqueKeyPropertyName, boolean lazy, boolean isEmbeddedInXML, boolean ignoreNotFound)
           
 
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.
 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 isAlwaysDirtyChecked()
          Do we dirty check this association, even when there are no columns to be updated?
 boolean isModified(Object old, Object current, SessionImplementor session)
          Has the parent object been modified, compared to the current database state?
protected  boolean isNullable()
           
 boolean isOneToOne()
           
 void nullSafeSet(PreparedStatement st, Object value, int index, boolean[] settable, SessionImplementor session)
          Write an instance of the mapped class to a prepared statement, ignoring some columns.
 void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session)
          Write an instance of the mapped class to a prepared statement.
 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.EntityType
compare, deepCopy, fromXMLNode, getAssociatedEntityName, getAssociatedEntityName, getAssociatedJoinable, getHashCode, getIdentifier, getIdentifierOrUniqueKeyPropertyName, getIdentifierOrUniqueKeyType, getLHSPropertyName, getName, getOnCondition, getPropertyName, getReturnedClass, getRHSUniqueKeyPropertyName, getSemiResolvedType, isAssociationType, isDirty, isEmbeddedInXML, isEntityType, isEqual, isMutable, isNotEmbedded, isNull, isReferenceToPrimaryKey, isSame, isXMLElement, loadByUniqueKey, nullSafeGet, nullSafeGet, replace, resolve, resolveIdentifier, setToXMLNode, toLoggableString, toString
 
Methods inherited from class org.hibernate.type.AbstractType
getHashCode, isAnyType, isCollectionType, isComponentType, isEqual, 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
getHashCode, isAnyType, isCollectionType, isComponentType, isEqual, semiResolve
 

Constructor Detail

ManyToOneType

public ManyToOneType(String className)

ManyToOneType

public ManyToOneType(String className,
                     boolean lazy)

ManyToOneType

public ManyToOneType(String className,
                     String uniqueKeyPropertyName,
                     boolean lazy,
                     boolean isEmbeddedInXML,
                     boolean ignoreNotFound)
Method Detail

isNullable

protected boolean isNullable()
Specified by:
isNullable in class EntityType

isAlwaysDirtyChecked

public boolean isAlwaysDirtyChecked()
Description copied from interface: AssociationType
Do we dirty check this association, even when there are no columns to be updated?


getColumnSpan

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

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.

Returns:
the typecodes
Throws:
MappingException
See Also:
Types

nullSafeSet

public void nullSafeSet(PreparedStatement st,
                        Object value,
                        int index,
                        boolean[] settable,
                        SessionImplementor session)
                 throws HibernateException,
                        SQLException
Description copied from interface: Type
Write an instance of the mapped class to a prepared statement, ignoring some columns. 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
settable - an array indicating which columns to ignore
session -
Throws:
HibernateException
SQLException

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:
HibernateException
SQLException

isOneToOne

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

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
Overrides:
hydrate in class AbstractType
Throws:
HibernateException
SQLException

useLHSPrimaryKey

public boolean useLHSPrimaryKey()
Description copied from interface: AssociationType
Is the primary key of the owning entity table to be used in the join?


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

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