|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.hibernate.engine.internal.NaturalIdXrefDelegate
public class NaturalIdXrefDelegate
Maintains a PersistenceContext-level 2-way cross-reference (xref) between the
identifiers and natural ids of entities associated with the PersistenceContext.
NaturalIdResolutionCache to use based on the persister and
simply delegate calls there.
| Constructor Summary | |
|---|---|
NaturalIdXrefDelegate(StatefulPersistenceContext persistenceContext)
|
|
| Method Summary | |
|---|---|
boolean |
cacheNaturalIdCrossReference(EntityPersister persister,
Serializable pk,
Object[] naturalIdValues)
Creates needed cross-reference entries between the given primary (pk) and natural (naturalIdValues) key values for the given persister. |
void |
clear()
|
Object[] |
findCachedNaturalId(EntityPersister persister,
Serializable pk)
Given a persister and primary key, find the locally cross-referenced natural id. |
Serializable |
findCachedNaturalIdResolution(EntityPersister persister,
Object[] naturalIdValues)
Given a persister and natural-id value(s), find the locally cross-referenced primary key. |
Collection<Serializable> |
getCachedPkResolutions(EntityPersister persister)
Return all locally cross-referenced primary keys for the given persister. |
protected EntityPersister |
locatePersisterForKey(EntityPersister persister)
It is only valid to define natural ids at the root of an entity hierarchy. |
Object[] |
removeNaturalIdCrossReference(EntityPersister persister,
Serializable pk,
Object[] naturalIdValues)
Handle removing cross reference entries for the given natural-id/pk combo |
boolean |
sameAsCached(EntityPersister persister,
Serializable pk,
Object[] naturalIdValues)
Are the naturals id values cached here (if any) for the given persister+pk combo the same as the given values? |
protected SessionImplementor |
session()
Access to the session (via the PersistenceContext) to which this delegate ultimately belongs. |
void |
stashInvalidNaturalIdReference(EntityPersister persister,
Object[] invalidNaturalIdValues)
As part of "load synchronization process", if a particular natural id is found to have changed we need to track its invalidity until after the next flush. |
void |
unStashInvalidNaturalIdReferences()
Again, as part of "load synchronization process" we need to also be able to clear references to these known-invalid natural-ids after flush. |
protected void |
validateNaturalId(EntityPersister persister,
Object[] naturalIdValues)
Invariant validate of the natural id. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public NaturalIdXrefDelegate(StatefulPersistenceContext persistenceContext)
| Method Detail |
|---|
protected SessionImplementor session()
public boolean cacheNaturalIdCrossReference(EntityPersister persister,
Serializable pk,
Object[] naturalIdValues)
false would be returned here.
persister - The persister representing the entity type.pk - The primary key valuenaturalIdValues - The natural id value(s)
true if a new entry was actually added; false otherwise.
public Object[] removeNaturalIdCrossReference(EntityPersister persister,
Serializable pk,
Object[] naturalIdValues)
persister - The persister representing the entity type.pk - The primary key valuenaturalIdValues - The natural id value(s)
public boolean sameAsCached(EntityPersister persister,
Serializable pk,
Object[] naturalIdValues)
persister - The persister representing the entity type.pk - The primary key valuenaturalIdValues - The natural id value(s) to check
true if the given naturalIdValues match the current cached values; false otherwise.protected EntityPersister locatePersisterForKey(EntityPersister persister)
persister - The persister representing the entity type.
protected void validateNaturalId(EntityPersister persister,
Object[] naturalIdValues)
persister - The persister representing the entity type.naturalIdValues - The natural id values
public Object[] findCachedNaturalId(EntityPersister persister,
Serializable pk)
persister - The persister representing the entity type.pk - The entity primary key
null if none
public Serializable findCachedNaturalIdResolution(EntityPersister persister,
Object[] naturalIdValues)
PersistenceContext.NaturalIdHelper#INVALID_NATURAL_ID_REFERENCE if the given natural ids are known to
be invalid (see stashInvalidNaturalIdReference(org.hibernate.persister.entity.EntityPersister, java.lang.Object[])).
persister - The persister representing the entity type.naturalIdValues - The natural id value(s)
PersistenceContext.NaturalIdHelper#INVALID_NATURAL_ID_REFERENCE,
or null if nonepublic Collection<Serializable> getCachedPkResolutions(EntityPersister persister)
persister - The persister representing the entity type.
NaturalIdLoadAccess.setSynchronizationEnabled(boolean)
public void stashInvalidNaturalIdReference(EntityPersister persister,
Object[] invalidNaturalIdValues)
persister - The persister representing the entity type.invalidNaturalIdValues - The "old" natural id values.NaturalIdLoadAccess.setSynchronizationEnabled(boolean)public void unStashInvalidNaturalIdReferences()
public void clear()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||