public class

OneToOneType

extends EntityType
java.lang.Object
   ↳ org.hibernate.type.AbstractType
     ↳ org.hibernate.type.EntityType
       ↳ org.hibernate.type.OneToOneType
Known Direct Subclasses

Class Overview

A one-to-one association to an entity

Summary

[Expand]
Inherited Fields
From class org.hibernate.type.EntityType
Public Constructors
OneToOneType(TypeFactory.TypeScope scope, String referencedEntityName, ForeignKeyDirection foreignKeyType, String uniqueKeyPropertyName, boolean lazy, boolean unwrapProxy, boolean isEmbeddedInXML, String entityName, String propertyName)
Public Methods
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 session)
ForeignKeyDirection getForeignKeyDirection()
String getPropertyName()
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()
We don't need to dirty check one-to-one because of how assemble/disassemble is implemented and because a one-to-one association is never dirty
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 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 isNull(Object owner, SessionImplementor session)
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 session)
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 OneToOneType (TypeFactory.TypeScope scope, String referencedEntityName, ForeignKeyDirection foreignKeyType, String uniqueKeyPropertyName, boolean lazy, boolean unwrapProxy, boolean isEmbeddedInXML, String entityName, String propertyName)

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

public ForeignKeyDirection getForeignKeyDirection ()

public String getPropertyName ()

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

We don't need to dirty check one-to-one because of how assemble/disassemble is implemented and because a one-to-one association is never dirty

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 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 isNull (Object owner, SessionImplementor session)

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

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

public boolean useLHSPrimaryKey ()

Protected Methods

protected boolean isNullable ()