A many-to-one association to an entity.
ManyToOneType
public ManyToOneType(String className)
ManyToOneType
public ManyToOneType(String entityName,
String uniqueKeyPropertyName,
boolean lazy,
boolean unwrapProxy,
boolean isEmbeddedInXML,
boolean ignoreNotFound)
ManyToOneType
public ManyToOneType(String className,
boolean lazy)
disassemble
public Serializable disassemble(Object value,
SessionImplementor session,
Object owner)
throws HibernateException
Return a cacheable "disassembled" representation of the object.
- disassemble in interface Type
- disassemble in interface AbstractType
value
- the value to cachesession
- the sessionowner
- optional parent entity object (needed for collections)
- the disassembled, deep cloned state
hydrate
public Object hydrate(ResultSet rs,
String[] names,
SessionImplementor session,
Object owner)
throws HibernateException,
SQLException
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().
- hydrate in interface Type
- hydrate in interface AbstractType
rs
- names
- the column namessession
- the sessionowner
- the parent entity
- Object an identifier or actual value
isDirty
public boolean isDirty(Object old,
Object current,
boolean[] checkable,
SessionImplementor session)
throws HibernateException
Should the parent be considered dirty, given both the old and current field or
element value?
- isDirty in interface Type
old
- the old valuecurrent
- the current valuecheckable
- which columns are actually updatablesession
-
- true if the field is dirty
isDirty
public boolean isDirty(Object old,
Object current,
SessionImplementor session)
throws HibernateException
Should the parent be considered dirty, given both the old and current field or
element value?
- isDirty in interface Type
- isDirty in interface AbstractType
old
- the old valuecurrent
- the current valuesession
-
- true if the field is dirty
isModified
public boolean isModified(Object old,
Object current,
boolean[] checkable,
SessionImplementor session)
throws HibernateException
Has the parent object been modified, compared to the current database state?
- isModified in interface Type
- isModified in interface AbstractType
checkable
- which columns are actually updatablesession
-
- true if the field has been modified
nullSafeSet
public void nullSafeSet(PreparedStatement st,
Object value,
int index,
boolean[] settable,
SessionImplementor session)
throws HibernateException,
SQLException
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.
- nullSafeSet in interface Type
st
- value
- the object to writeindex
- statement parameter indexsettable
- an array indicating which columns to ignoresession
-
nullSafeSet
public void nullSafeSet(PreparedStatement st,
Object value,
int index,
SessionImplementor session)
throws HibernateException,
SQLException
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.
- nullSafeSet in interface Type
st
- value
- the object to writeindex
- statement parameter indexsession
-
sqlTypes
public int[] sqlTypes(Mapping mapping)
throws MappingException
Return the SQL type codes for the columns mapped by this type. The codes
are defined on java.sql.Types.
- sqlTypes in interface Type
toColumnNullness
public boolean[] toColumnNullness(Object value,
Mapping mapping)
Given an instance of the type, return an array of boolean, indicating
which mapped columns would be null.
- toColumnNullness in interface Type
value
- an instance of the type