|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.hibernate.type.AbstractType org.hibernate.type.EntityType org.hibernate.type.ManyToOneType
public class ManyToOneType
A many-to-one association to an entity.
Field Summary |
---|
Fields inherited from class org.hibernate.type.EntityType |
---|
isEmbeddedInXML, uniqueKeyPropertyName |
Fields inherited from class org.hibernate.type.AbstractType |
---|
LEGACY_DEFAULT_SIZE, LEGACY_DICTATED_SIZE |
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 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. |
Size[] |
defaultSizes(Mapping mapping)
Defines the column sizes to use according to this type if the user did not explicitly say (and if no Type.dictatedSizes(org.hibernate.engine.spi.Mapping) were given). |
Size[] |
dictatedSizes(Mapping mapping)
Return the column sizes dictated by this type. |
Serializable |
disassemble(Object value,
SessionImplementor session,
Object owner)
Return a 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)
Extract a value from the JDBC result set. |
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.spi.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)
Bind a value represented by an instance of the mapped class to the JDBC prepared
statement, ignoring some columns as dictated by the 'settable' parameter. |
void |
nullSafeSet(PreparedStatement st,
Object value,
int index,
SessionImplementor session)
Bind a value represented by an instance of the mapped class to the JDBC 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.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 |
---|
public ManyToOneType(TypeFactory.TypeScope scope, String referencedEntityName)
scope
- The scope for this instance.referencedEntityName
- The name iof the referenced entitypublic ManyToOneType(TypeFactory.TypeScope scope, String referencedEntityName, boolean lazy)
scope
- The scope for this instance.referencedEntityName
- The name iof the referenced entitylazy
- Should the association be handled lazilypublic ManyToOneType(TypeFactory.TypeScope scope, String referencedEntityName, String uniqueKeyPropertyName, boolean lazy, boolean unwrapProxy, boolean isEmbeddedInXML, boolean ignoreNotFound, boolean isLogicalOneToOne)
Method Detail |
---|
protected boolean isNullable()
isNullable
in class EntityType
public boolean isAlwaysDirtyChecked()
AssociationType
public boolean isOneToOne()
EntityType
isOneToOne
in class EntityType
public boolean isLogicalOneToOne()
EntityType
isLogicalOneToOne
in class EntityType
public int getColumnSpan(Mapping mapping) throws MappingException
Type
sqlTypes(mapping).length
mapping
- The mapping object :/
MappingException
- Generally indicates an issue accessing the passed mapping object.public int[] sqlTypes(Mapping mapping) throws MappingException
Type
Types
) for the columns mapped by this type.
NOTE: The number of elements in this array matches the return from Type.getColumnSpan(org.hibernate.engine.spi.Mapping)
.
mapping
- The mapping object :/
MappingException
- Generally indicates an issue accessing the passed mapping object.public Size[] dictatedSizes(Mapping mapping) throws MappingException
Type
char
/Character
would
have a dictated length limit of 1; for a string-based UUID
would have a size limit of 36; etc.
NOTE: The number of elements in this array matches the return from Type.getColumnSpan(org.hibernate.engine.spi.Mapping)
.
mapping
- The mapping object :/
MappingException
- Generally indicates an issue accessing the passed mapping object.public Size[] defaultSizes(Mapping mapping) throws MappingException
Type
Type.dictatedSizes(org.hibernate.engine.spi.Mapping)
were given).
NOTE: The number of elements in this array matches the return from Type.getColumnSpan(org.hibernate.engine.spi.Mapping)
.
mapping
- The mapping object :/
MappingException
- Generally indicates an issue accessing the passed mapping object.public void nullSafeSet(PreparedStatement st, Object value, int index, boolean[] settable, SessionImplementor session) throws HibernateException, SQLException
Type
mapped class
to the JDBC prepared
statement, ignoring some columns as dictated by the 'settable' parameter. Implementors should handle the
possibility of null values. A multi-column type should bind parameters starting from index.
st
- The JDBC prepared statement to which to bindvalue
- the object to writeindex
- starting parameter bind indexsettable
- an array indicating which columns to bind/ignoresession
- The originating session
HibernateException
- An error from Hibernate
SQLException
- An error from the JDBC driverpublic void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session) throws HibernateException, SQLException
Type
mapped class
to the JDBC prepared
statement. Implementors should handle possibility of null values. A multi-column type should bind parameters
starting from index.
st
- The JDBC prepared statement to which to bindvalue
- the object to writeindex
- starting parameter bind indexsession
- The originating session
HibernateException
- An error from Hibernate
SQLException
- An error from the JDBC driverpublic ForeignKeyDirection getForeignKeyDirection()
AssociationType
public Object hydrate(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws HibernateException, SQLException
Type
Type.resolve(java.lang.Object, org.hibernate.engine.spi.SessionImplementor, java.lang.Object)
This hydrated value will be either:
hydrate
in interface Type
hydrate
in class AbstractType
rs
- The JDBC result setnames
- the column names making up this type value (use to read from result set)session
- The originating sessionowner
- the parent entity
HibernateException
- An error from Hibernate
SQLException
- An error from the JDBC driverType.resolve(java.lang.Object, org.hibernate.engine.spi.SessionImplementor, java.lang.Object)
public boolean useLHSPrimaryKey()
AssociationType
public boolean isModified(Object old, Object current, boolean[] checkable, SessionImplementor session) throws HibernateException
Type
Type.isDirty(java.lang.Object, java.lang.Object, org.hibernate.engine.spi.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.spi.SessionImplementor)
here/
isModified
in interface Type
isModified
in class AbstractType
old
- the database state, in a "hydrated" form, with identifiers unresolvedcurrent
- the current state of the objectcheckable
- which columns are actually updatablesession
- The session from which the request originated.
HibernateException
- A problem occurred performing the checkingpublic Serializable disassemble(Object value, SessionImplementor session, Object owner) throws HibernateException
Type
disassemble
in interface Type
disassemble
in class AbstractType
value
- the value to cachesession
- the originating sessionowner
- optional parent entity object (needed for collections)
HibernateException
- An error from Hibernatepublic Object assemble(Serializable oid, SessionImplementor session, Object owner) throws HibernateException
Type
Type.disassemble(java.lang.Object, org.hibernate.engine.spi.SessionImplementor, java.lang.Object)
assemble
in interface Type
assemble
in class AbstractType
oid
- the disassembled state from the cachesession
- the originating sessionowner
- the parent entity object
HibernateException
- An error from Hibernatepublic void beforeAssemble(Serializable oid, SessionImplementor session)
Type
beforeAssemble
in interface Type
beforeAssemble
in class AbstractType
oid
- The keysession
- The originating sessionpublic boolean[] toColumnNullness(Object value, Mapping mapping)
Type
value
- an instance of the typemapping
- The mapping abstraction
public boolean isDirty(Object old, Object current, SessionImplementor session) throws HibernateException
Type
isDirty
in interface Type
isDirty
in class AbstractType
old
- the old valuecurrent
- the current valuesession
- The session from which the request originated.
HibernateException
- A problem occurred performing the checkingpublic boolean isDirty(Object old, Object current, boolean[] checkable, SessionImplementor session) throws HibernateException
Type
old
- the old valuecurrent
- the current valuecheckable
- An array of booleans indicating which columns making up the value are actually checkablesession
- The session from which the request originated.
HibernateException
- A problem occurred performing the checking
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |