public class ManyToOneType extends EntityType
A many-to-one association to an entity.
uniqueKeyPropertyName
LEGACY_DEFAULT_SIZE, LEGACY_DICTATED_SIZE
Constructor and Description |
---|
ManyToOneType(ManyToOneType original,
String superTypeEntityName) |
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,
boolean referenceToPrimaryKey,
String uniqueKeyPropertyName,
boolean lazy,
boolean unwrapProxy,
boolean ignoreNotFound,
boolean isLogicalOneToOne)
|
ManyToOneType(TypeFactory.TypeScope scope,
String referencedEntityName,
boolean referenceToPrimaryKey,
String uniqueKeyPropertyName,
String propertyName,
boolean lazy,
boolean unwrapProxy,
boolean ignoreNotFound,
boolean isLogicalOneToOne) |
ManyToOneType(TypeFactory.TypeScope scope,
String referencedEntityName,
String uniqueKeyPropertyName,
boolean lazy,
boolean unwrapProxy,
boolean isEmbeddedInXML,
boolean ignoreNotFound,
boolean isLogicalOneToOne)
|
Modifier and Type | Method and Description |
---|---|
Object |
assemble(Serializable oid,
SharedSessionContractImplementor session,
Object owner)
Reconstruct the object from its disassembled state.
|
void |
beforeAssemble(Serializable oid,
SharedSessionContractImplementor 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,
SharedSessionContractImplementor 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
|
String |
getPropertyName() |
Object |
hydrate(ResultSet rs,
String[] names,
SharedSessionContractImplementor 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,
SharedSessionContractImplementor session)
Should the parent be considered dirty, given both the old and current value?
|
boolean |
isDirty(Object old,
Object current,
SharedSessionContractImplementor 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,
SharedSessionContractImplementor 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.SharedSessionContractImplementor) 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)?
|
Object |
resolve(Object value,
SharedSessionContractImplementor session,
Object owner,
Boolean overridingEager)
The second phase of 2-phase loading.
|
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?
|
compare, deepCopy, getAssociatedEntityName, getAssociatedEntityName, getAssociatedEntityPersister, getAssociatedJoinable, getHashCode, getIdentifier, getIdentifierOrUniqueKeyPropertyName, getIdentifierOrUniqueKeyType, getLHSPropertyName, getName, getOnCondition, getOnCondition, getReturnedClass, getRHSUniqueKeyPropertyName, getSemiResolvedType, isAssociationType, isEntityType, isEqual, isMutable, isNull, isReferenceToPrimaryKey, isSame, loadByUniqueKey, nullSafeGet, nullSafeGet, nullSafeSet, nullSafeSet, replace, requireIdentifierOrUniqueKeyType, resolve, resolveIdentifier, resolveIdentifier, scope, toLoggableString, toString
getHashCode, isAnyType, isCollectionType, isComponentType, isEqual, replace, semiResolve
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getHashCode, isAnyType, isCollectionType, isComponentType, isEqual, replace, semiResolve
public ManyToOneType(TypeFactory.TypeScope scope, String referencedEntityName)
Creates a many-to-one association type with the given referenced entity.
scope
- The scope for this instance.referencedEntityName
- The name iof the referenced entitypublic 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
scope
- The scope for this instance.referencedEntityName
- The name iof the referenced entitylazy
- Should the association be handled lazily@Deprecated public ManyToOneType(TypeFactory.TypeScope scope, String referencedEntityName, String uniqueKeyPropertyName, boolean lazy, boolean unwrapProxy, boolean isEmbeddedInXML, boolean ignoreNotFound, boolean isLogicalOneToOne)
@Deprecated public ManyToOneType(TypeFactory.TypeScope scope, String referencedEntityName, boolean referenceToPrimaryKey, String uniqueKeyPropertyName, boolean lazy, boolean unwrapProxy, boolean ignoreNotFound, boolean isLogicalOneToOne)
public ManyToOneType(TypeFactory.TypeScope scope, String referencedEntityName, boolean referenceToPrimaryKey, String uniqueKeyPropertyName, String propertyName, boolean lazy, boolean unwrapProxy, boolean ignoreNotFound, boolean isLogicalOneToOne)
public ManyToOneType(ManyToOneType original, String superTypeEntityName)
protected boolean isNullable()
isNullable
in class EntityType
public String getPropertyName()
getPropertyName
in class EntityType
public boolean isAlwaysDirtyChecked()
AssociationType
Do we dirty check this association, even when there are no columns to be updated?
public boolean isOneToOne()
EntityType
Is the association modeled here defined as a 1-1 in the database (physical model)?
isOneToOne
in class EntityType
public boolean isLogicalOneToOne()
EntityType
Is the association modeled here a 1-1 according to the logical moidel?
isLogicalOneToOne
in class EntityType
public int getColumnSpan(Mapping mapping) throws MappingException
Type
How many columns are used to persist this type. Always the same as 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
Return the JDBC types codes (per Types
) for the columns mapped by this type.
<p/>
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
Return the column sizes dictated by this type. For example, the mapping for a char
/Character
would
have a dictated length limit of 1; for a string-based UUID
would have a size limit of 36; etc.
<p/>
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
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).
<p/>
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 ForeignKeyDirection getForeignKeyDirection()
AssociationType
Get the foreign key directionality of this association
public Object hydrate(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException
Type
Extract a value from the JDBC result set. This is useful for 2-phase property initialization - the second
phase is a call to Type.resolve(java.lang.Object, org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object)
This hydrated value will be either:<ul>
<li>in the case of an entity or collection type, the key</li>
<li>otherwise, the value itself</li>
</ul>
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 entityHibernateException
- An error from HibernateSQLException
- An error from the JDBC driverType.resolve(java.lang.Object, org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object)
public boolean useLHSPrimaryKey()
AssociationType
Is the primary key of the owning entity table to be used in the join?
public boolean isModified(Object old, Object current, boolean[] checkable, SharedSessionContractImplementor session) throws HibernateException
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.spi.SharedSessionContractImplementor)
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.SharedSessionContractImplementor)
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 Object resolve(Object value, SharedSessionContractImplementor session, Object owner, Boolean overridingEager) throws HibernateException
Type
The second phase of 2-phase loading. Only really pertinent for entities and collections. Here we resolve the identifier to an entity or collection instance
resolve
in interface Type
resolve
in class EntityType
value
- an identifier or value returned by <tt>hydrate()</tt>session
- the sessionowner
- the parent entityoverridingEager
- can override eager from the mapping. For example because of LoadQueryInfluencers
If null, then it does not override. If true or false then it overrides the mapping value.HibernateException
- An error from HibernateType.hydrate(java.sql.ResultSet, java.lang.String[], org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object)
public Serializable disassemble(Object value, SharedSessionContractImplementor session, Object owner) throws HibernateException
Type
Return a disassembled representation of the object. This is the value Hibernate will use in second level caching, so care should be taken to break values down to their simplest forms; for entities especially, this means breaking them down into their constituent parts.
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, SharedSessionContractImplementor session, Object owner) throws HibernateException
Type
Reconstruct the object from its disassembled state. This method is the reciprocal of Type.disassemble(java.lang.Object, org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object)
assemble
in interface Type
assemble
in class AbstractType
oid
- the disassembled state from the cachesession
- the originating sessionowner
- the parent entity objectHibernateException
- An error from Hibernatepublic void beforeAssemble(Serializable oid, SharedSessionContractImplementor session)
Type
Called before assembling a query result set from the query cache, to allow batch fetching of entities missing from the second-level cache.
beforeAssemble
in interface Type
beforeAssemble
in class AbstractType
oid
- The keysession
- The originating sessionpublic boolean[] toColumnNullness(Object value, Mapping mapping)
Type
Given an instance of the type, return an array of boolean, indicating which mapped columns would be null.
value
- an instance of the typemapping
- The mapping abstractionpublic boolean isDirty(Object old, Object current, SharedSessionContractImplementor session) throws HibernateException
Type
Should the parent be considered dirty, given both the old and current value?
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, SharedSessionContractImplementor session) throws HibernateException
Type
Should the parent be considered dirty, given both the old and current value?
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 checkingCopyright © 2001-2018 Red Hat, Inc. All Rights Reserved.