Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.hibernate.type
Class ManyToOneType

    java.lang.Object
      org.hibernate.type.AbstractType
          org.hibernate.type.EntityType
              org.hibernate.type.ManyToOneType

All Implemented Interfaces:
  Serializable, AssociationType, 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(TypeFactory.TypeScope scope, String referencedEntityName)` Creates a many-to-one association type with the given referenced entity.
`ManyToOneType(TypeFactory.TypeScope scope, String referencedEntityName, boolean lazy)` Creates a many-to-one association type with the given referenced entity and the given laziness characteristic
`ManyToOneType(TypeFactory.TypeScope scope, String referencedEntityName, String uniqueKeyPropertyName, boolean lazy, boolean unwrapProxy, boolean isEmbeddedInXML, boolean ignoreNotFound, boolean isLogicalOneToOne)`

Method Summary
`Object` | `assemble(Serializable oid, SessionImplementor session, Object owner)` Reconstruct the object from its cached "disassembled" state.
`void` | `beforeAssemble(Serializable oid, SessionImplementor session)` Called before assembling a query result set from the query cache, to allow batch fetching of entities missing from the second-level cache.
`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` | `isDirty(Object old, Object current, boolean[] checkable, SessionImplementor session)` Should the parent be considered dirty, given both the old and current value?
`boolean` | `isDirty(Object old, Object current, SessionImplementor session)` Should the parent be considered dirty, given both the old and current value?
`boolean` | `isLogicalOneToOne()` Is the association modeled here a 1-1 according to the logical moidel?
`boolean` | `isModified(Object old, Object current, boolean[] checkable, SessionImplementor session)` Has the value been modified compared to the current database state? The difference between this and the `Type.isDirty(java.lang.Object, java.lang.Object, org.hibernate.engine.SessionImplementor)` methods is that here we need to account for "partially" built values.
`protected boolean` | `isNullable()`
`boolean` | `isOneToOne()` Is the association modeled here defined as a 1-1 in the database (physical model)?
`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 JDBC types codes (per `Types`) for the columns mapped by this type.
`boolean[]` | `toColumnNullness(Object value, Mapping mapping)` Given an instance of the type, return an array of boolean, indicating which mapped columns would be null.
`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, isEmbeddedInXML, isEntityType, isEqual, isMutable, isNotEmbedded, isNull, isReferenceToPrimaryKey, isSame, isXMLElement, loadByUniqueKey, nullSafeGet, nullSafeGet, replace, resolve, resolveIdentifier, scope, setToXMLNode, toLoggableString, toString`

Methods inherited from class org.hibernate.type.AbstractType
`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
`getHashCode, isAnyType, isCollectionType, isComponentType, isEqual, replace, semiResolve`

Constructor Detail

### ManyToOneType

    public ManyToOneType(TypeFactory.TypeScope scope,
                         String referencedEntityName)

  Creates a many-to-one association type with the given referenced entity.

  Parameters:
    `scope` - The scope for this instance.
    `referencedEntityName` - The name iof the referenced entity

### ManyToOneType

    public ManyToOneType(TypeFactory.TypeScope scope,
                         String referencedEntityName,
                         boolean lazy)

  Creates a many-to-one association type with the given referenced entity and the given laziness characteristic

  Parameters:
    `scope` - The scope for this instance.
    `referencedEntityName` - The name iof the referenced entity
    `lazy` - Should the association be handled lazily

### ManyToOneType

    public ManyToOneType(TypeFactory.TypeScope scope,
                         String referencedEntityName,
                         String uniqueKeyPropertyName,
                         boolean lazy,
                         boolean unwrapProxy,
                         boolean isEmbeddedInXML,
                         boolean ignoreNotFound,
                         boolean isLogicalOneToOne)

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?

### isOneToOne

    public boolean isOneToOne()

  Description copied from class: `EntityType`
  Is the association modeled here defined as a 1-1 in the database (physical model)?

  Specified by:
    `isOneToOne` in class `EntityType`
  Returns:
    True if a 1-1 in the database; false otherwise.

### isLogicalOneToOne

    public boolean isLogicalOneToOne()

  Description copied from class: `EntityType`
  Is the association modeled here a 1-1 according to the logical moidel?

  Overrides:
    `isLogicalOneToOne` in class `EntityType`
  Returns:
    True if a 1-1 in the logical model; false otherwise.

### 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 as `sqlTypes(mapping).length`

  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 (per `Types`) for the columns mapped by this type.

  Parameters:
    `mapping` - The mapping object :/
  Returns:
    The JDBC type codes.
  Throws:
    `MappingException` - Generally indicates an issue accessing the passed mapping object.

### 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`.

    `value` - the object to write
    `index` - statement parameter index
    `settable` - an array indicating which columns to ignore
  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`.

    `value` - the object to write
    `index` - statement parameter index
  Throws:
    `HibernateException`
    `SQLException`

### 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`
    `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)`

### 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,
                              boolean[] checkable,
                              SessionImplementor session)
                       throws HibernateException

  Description copied from interface: `Type`
  Has the value been modified compared to the current database state? The difference between this and the `Type.isDirty(java.lang.Object, java.lang.Object, org.hibernate.engine.SessionImplementor)` methods is that here we need to account for "partially" built values. This is really only an issue with association types. For most type implementations it is enough to simply delegate to `Type.isDirty(java.lang.Object, java.lang.Object, org.hibernate.engine.SessionImplementor)` here/

  Specified by:
    `isModified` in interface `Type`
  Overrides:
    `isModified` in class `AbstractType`
  Parameters:
    `old` - the database state, in a "hydrated" form, with identifiers unresolved
    `current` - the current state of the object
    `checkable` - which columns are actually updatable
    `session` - The session from which the request originated.
  Returns:
    true if the field has been modified
  Throws:
    `HibernateException` - A problem occurred performing the checking

### 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`
  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 `AbstractType`
  Parameters:
    `oid` - the disassembled state from the cache
    `session` - the session
    `owner` - the parent entity object
  Returns:
    the the object
  Throws:
    `HibernateException`

### beforeAssemble

    public void beforeAssemble(Serializable oid,
                               SessionImplementor session)

  Description copied from interface: `Type`
  Called before assembling a query result set from the query cache, to allow batch fetching of entities missing from the second-level cache.

  Specified by:
    `beforeAssemble` in interface `Type`
  Overrides:
    `beforeAssemble` in class `AbstractType`

### toColumnNullness

    public boolean[] toColumnNullness(Object value,
                                      Mapping mapping)

  Description copied from interface: `Type`
  Given an instance of the type, return an array of boolean, indicating which mapped columns would be null.

  Parameters:
    `value` - an instance of the type

### 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 value?

  Specified by:
    `isDirty` in interface `Type`
  Overrides:
    `isDirty` in class `AbstractType`
  Parameters:
    `old` - the old value
    `current` - the current value
    `session` - The session from which the request originated.
  Returns:
    true if the field is dirty
  Throws:
    `HibernateException` - A problem occurred performing the checking

### isDirty

    public boolean isDirty(Object old,
                           Object current,
                           boolean[] checkable,
                           SessionImplementor session)
                    throws HibernateException

  Description copied from interface: `Type`
  Should the parent be considered dirty, given both the old and current value?

  Parameters:
    `old` - the old value
    `current` - the current value
    `checkable` - An array of booleans indicating which columns making up the value are actually checkable
    `session` - The session from which the request originated.
  Returns:
    true if the field is dirty
  Throws:
    `HibernateException` - A problem occurred performing the checking

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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