public class

ManyToOneType

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

Class Overview

A many-to-one association to an entity.

Summary

[Expand]
Inherited Fields
From class org.hibernate.type.EntityType
Public Constructors
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)
Public Methods
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)
ForeignKeyDirection getForeignKeyDirection()
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()
boolean isDirty(Object old, Object current, SessionImplementor session)
Should the parent be considered dirty, given both the old and current value?
boolean isDirty(Object old, Object current, boolean[] checkable, SessionImplementor session)
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 isDirty(Object, Object, boolean[], SessionImplementor) methods is that here we need to account for "partially" built values.
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)
void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session)
int[] sqlTypes(Mapping mapping)
boolean[] toColumnNullness(Object value, Mapping mapping)
boolean useLHSPrimaryKey()
Protected Methods
boolean isNullable()
[Expand]
Inherited Methods
From class org.hibernate.type.EntityType
From class org.hibernate.type.AbstractType
From class java.lang.Object
From interface org.hibernate.type.AssociationType
From interface org.hibernate.type.Type

Public Constructors

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

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

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

Public Methods

public Object assemble (Serializable oid, SessionImplementor session, Object owner)

Reconstruct the object from its cached "disassembled" state.

Parameters
oid the disassembled state from the cache
session the session
owner the parent entity object
Returns
  • the the object

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

public Serializable disassemble (Object value, SessionImplementor session, Object owner)

Return a cacheable "disassembled" representation of the object.

Parameters
value the value to cache
session the session
owner optional parent entity object (needed for collections)
Returns
  • the disassembled, deep cloned state

public int getColumnSpan (Mapping mapping)

public ForeignKeyDirection getForeignKeyDirection ()

public 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. This is useful for 2-phase property initialization - the second phase is a call to resolveIdentifier().

Parameters
names the column names
session the session
owner the parent entity
Returns
  • Object an identifier or actual value

public boolean isAlwaysDirtyChecked ()

public boolean isDirty (Object old, Object current, SessionImplementor session)

Should the parent be considered dirty, given both the old and current value?

Parameters
old the old value
current the current value
session The session from which the request originated.
Returns
  • true if the field is dirty

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

public boolean isLogicalOneToOne ()

Is the association modeled here a 1-1 according to the logical moidel?

Returns
  • True if a 1-1 in the logical model; false otherwise.

public 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 isDirty(Object, Object, boolean[], 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 isDirty(Object, Object, boolean[], SessionImplementor) here/

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

public boolean isOneToOne ()

Is the association modeled here defined as a 1-1 in the database (physical model)?

Returns
  • True if a 1-1 in the database; false otherwise.

public void nullSafeSet (PreparedStatement st, Object value, int index, boolean[] settable, SessionImplementor session)

public void nullSafeSet (PreparedStatement st, Object value, int index, SessionImplementor session)

public int[] sqlTypes (Mapping mapping)

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

public boolean useLHSPrimaryKey ()

Protected Methods

protected boolean isNullable ()