Top Description Fields Constructors Methods
org.eclipse.persistence.internal.sessions

public Class UnitOfWorkChangeSet

extends Object
implements Serializable, UnitOfWorkChangeSet
Class Inheritance
All Implemented Interfaces
org.eclipse.persistence.sessions.changesets.UnitOfWorkChangeSet, java.io.Serializable
Imports
java.io.Serializable, java.util.HashMap, .HashSet, .IdentityHashMap, .Iterator, .Map, .Set, org.eclipse.persistence.descriptors.ClassDescriptor, org.eclipse.persistence.internal.identitymaps.CacheId, .CacheKey, org.eclipse.persistence.mappings.DatabaseMapping, org.eclipse.persistence.queries.FetchGroup

Purpose: This is the overall collection of changes.

Description: It holds all of the object changes and all ObjectChanges, with the same classType and primary keys, referenced in a changeSet should be the same object.

Field Summary

Modifier and TypeField and Description
protected Map<ObjectChangeSet, ObjectChangeSet>
protected Map<ObjectChangeSet, ObjectChangeSet>
protected Map<Object, ObjectChangeSet>
protected Map<ObjectChangeSet, ObjectChangeSet>
protected boolean
hasChanges

This attribute is set to true if a changeSet with changes has been added

protected boolean
protected boolean
isChangeSetFromOutsideUOW

Flag set when calling commitToDatabaseWithPreBuiltChangeSet so we are aware the UOW does not contain the changes from this change set.

protected Map<Class<?>, Map<ObjectChangeSet, ObjectChangeSet>>
protected Map<Class<?>, Map<ObjectChangeSet, ObjectChangeSet>>
objectChanges

This is the collection of ObjectChanges held by this ChangeSet

protected Map<ObjectChangeSet, Object>
protected transient AbstractSession
session

Stores unit of work before it is serialized.

Constructor Summary

AccessConstructor and Description
public
UnitOfWorkChangeSet()

INTERNAL: Create a ChangeSet

public
UnitOfWorkChangeSet(AbstractSession session)

INTERNAL: Create a ChangeSet

Method Summary

Modifier and TypeMethod and Description
public void
addDeletedObject(Object object, AbstractSession session)

INTERNAL: Add the Deleted object to the changeSet.

public void
addDeletedObjects(Map<K, V> deletedObjects, AbstractSession session)

INTERNAL: Add the Deleted objects to the changeSet.

protected void
addNewObjectChangeSet(ObjectChangeSet
the new object change set
objectChanges
,
AbstractSession session)

INTERNAL: Add to the changes for 'object' object to this changeSet.

public void
addObjectChangeSet(ObjectChangeSet objectChanges, AbstractSession session, boolean
- Any pre commit actions should pass in true since new objects have extra-handling. Anything post commit, pass in false.
forceToNewObjectList
)

INTERNAL: Add to the changes for 'object' object to this changeSet.

public void
addObjectChangeSetForIdentity(ObjectChangeSet
prototype.changeset.ObjectChanges
objectChanges
,
Object object)

INTERNAL: Add change records to the lists used to maintain identity.

public UnitOfWorkChangeSet
buildCacheCoordinationMergeChangeSet(AbstractSession
current database session
session
)

INTERNAL: Return a new UnitOfWorkChangeSet that only includes data require for the remote merge, for cache coordination.

private void
ensureChanges(final AbstractSession
current database session
session
,
final ObjectChangeSet
change set to populate
changeSet
,
final ClassDescriptor
class (relational) descriptor related to the change set
descriptor
)

Ensure the change set is populated for cache coordination.

public ObjectChangeSet
findObjectChangeSet(ObjectChangeSet changeSet, UnitOfWorkChangeSet mergeFromChangeSet)

INTERNAL: This method can be used find the equivalent changeset within this UnitOfWorkChangeSet Aggregates, and new objects without primaryKeys from serialized ChangeSets will not be found Which may result in duplicates, in the UnitOfWorkChangeSet.

public ObjectChangeSet
findOrCreateLocalObjectChangeSet(Object entityClone, ClassDescriptor descriptor, boolean isNew)

INTERNAL" This method is used during the merge process to either find the existing ChangeSet or create a new one.

public ObjectChangeSet
findOrIntegrateObjectChangeSet(ObjectChangeSet tofind, UnitOfWorkChangeSet mergeFromChangeSet)

INTERNAL: This method will be used during the merge process to either find an equivalent change set within this UnitOfWorkChangeSet or integrate that changeset into this UOW ChangeSet

public Set<ClassDescriptor>
findUpdatedObjectsClasses()

INTERNAL: Returns the set of classes corresponding to updated objects in objectChanges.

public Map<ObjectChangeSet, ObjectChangeSet>
getAggregateChangeSets()

INTERNAL: Get the Aggregate list.

public Map<ObjectChangeSet, ObjectChangeSet>
getAllChangeSets()

Implements org.eclipse.persistence.sessions.changesets.UnitOfWorkChangeSet.getAllChangeSets.

INTERNAL: This method returns a reference to the collection.
public Map<Object, ObjectChangeSet>
getCloneToObjectChangeSet()

INTERNAL: Get the clone to object change hash table.

public Map<ObjectChangeSet, ObjectChangeSet>
getDeletedObjects()

Implements org.eclipse.persistence.sessions.changesets.UnitOfWorkChangeSet.getDeletedObjects.

INTERNAL: This method returns the reference to the deleted objects from the changeSet.
public Map<Class<?>, Map<ObjectChangeSet, ObjectChangeSet>>
getNewObjectChangeSets()

INTERNAL: This method will return a reference to the new object change set collections.

public Map<Class<?>, Map<ObjectChangeSet, ObjectChangeSet>>
getObjectChanges()

INTERNAL: Returns the ObjectChanges held by this ChangeSet.

public ObjectChangeSet

Returns:

ObjectChangeSet the changeSet that represents a particular clone
getObjectChangeSetForClone
(Object clone)

Implements org.eclipse.persistence.sessions.changesets.UnitOfWorkChangeSet.getObjectChangeSetForClone.

ADVANCED: Get ChangeSet for a particular clone
protected Map<ObjectChangeSet, Object>

Returns:

Map
getObjectChangeSetToUOWClone
()

INTERNAL: This method returns a reference to the collection

public AbstractSession
getSession()

Return the session.

public Object

Returns:

Object the clone represented by the changeSet
getUOWCloneForObjectChangeSet
(ObjectChangeSet changeSet)

Implements org.eclipse.persistence.sessions.changesets.UnitOfWorkChangeSet.getUOWCloneForObjectChangeSet.

ADVANCED: This method returns the Clone for a particular changeSet
public boolean
hasChanges()

Implements org.eclipse.persistence.sessions.changesets.UnitOfWorkChangeSet.hasChanges.

INTERNAL: Returns true if the Unit Of Work change Set has changes
public boolean
hasDeletedObjects()

INTERNAL: Returns true if any deleted objects.

public boolean

Returns:

boolean
hasForcedChanges
()

INTERNAL: Returns true if this uowChangeSet contains an objectChangeSet that has forced SQL changes.

public boolean
isChangeSetFromOutsideUOW()

INTERNAL: Get the internal flag that tells that this change set was built outside this UOW and the changes it contains cannot be calculated from the contents of this UOW

public ObjectChangeSet
mergeObjectChanges(ObjectChangeSet objectChangeSet, UnitOfWorkChangeSet mergeFromChangeSet)

INTERNAL: This method will be used to merge a change set into an UnitOfWorkChangeSet This method returns the local instance of the changeset

public void
mergeUnitOfWorkChangeSet(UnitOfWorkChangeSet mergeFromChangeSet, AbstractSession session, boolean postCommit)

INTERNAL: THis method will be used to merge another changeset into this changeset.

public void
putNewObjectInChangesList(ObjectChangeSet objectChangeSet, AbstractSession session)

INTERNAL: Used to rehash the new objects back into the objectChanges list for serialization Assumes the transaction in in post commit stage.

public void
removeObjectChangeSet(ObjectChangeSet changeSet)

INTERNAL: Add the changed Object's records to the ChangeSet.

public void
removeObjectChangeSetFromNewList(ObjectChangeSet objectChangeSet, AbstractSession session)

INTERNAL: Used to remove a new object from the new objects list once it has been inserted and added to the objectChangesList

public void
setAllChangeSets(Map<K, V> allChangeSets)

INTERNAL: Sets the collection of ObjectChanges in the change Set.

public void
setCloneToObjectChangeSet(Map<Object, ObjectChangeSet> cloneToObjectChangeSet)

INTERNAL: This method is used to set the map for cloneToObject reference.

public void
setDeletedObjects(Map<K, V> deletedObjects)

INTERNAL: Sets the collection of deleted objects.

public void
setHasChanges(boolean flag)

INTERNAL: Set whether the Unit Of Work change Set has changes

public void
setIsChangeSetFromOutsideUOW(boolean isChangeSetFromOutsideUOW)

INTERNAL: Set the internal flag that tells that this change set was built outside this UOW and the changes it contains cannot be calculated from the contents of this UOW

protected void
setObjectChanges(Map<K, V> objectChanges)

INTERNAL: Sets the collection of ObjectChanges in the change Set.

public void
setObjectChangeSetToUOWClone(Map<ObjectChangeSet, Object> objectChangeSetToUOWClone)

INTERNAL: This method is used to insert a new collection into the UOWChangeSet.

public void
setSession(AbstractSession session)

INTERNAL: Set the session.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

aggregateChangeSetsback to summary
protected Map<ObjectChangeSet, ObjectChangeSet> aggregateChangeSets
allChangeSetsback to summary
protected Map<ObjectChangeSet, ObjectChangeSet> allChangeSets
cloneToObjectChangeSetback to summary
protected Map<Object, ObjectChangeSet> cloneToObjectChangeSet
deletedObjectsback to summary
protected Map<ObjectChangeSet, ObjectChangeSet> deletedObjects
hasChangesback to summary
protected boolean hasChanges

This attribute is set to true if a changeSet with changes has been added

hasForcedChangesback to summary
protected boolean hasForcedChanges
isChangeSetFromOutsideUOWback to summary
protected boolean isChangeSetFromOutsideUOW

Flag set when calling commitToDatabaseWithPreBuiltChangeSet so we are aware the UOW does not contain the changes from this change set.

newObjectChangeSetsback to summary
protected Map<Class<?>, Map<ObjectChangeSet, ObjectChangeSet>> newObjectChangeSets
objectChangesback to summary
protected Map<Class<?>, Map<ObjectChangeSet, ObjectChangeSet>> objectChanges

This is the collection of ObjectChanges held by this ChangeSet

objectChangeSetToUOWCloneback to summary
protected Map<ObjectChangeSet, Object> objectChangeSetToUOWClone
sessionback to summary
protected transient AbstractSession session

Stores unit of work before it is serialized.

Constructor Detail

UnitOfWorkChangeSetback to summary
public UnitOfWorkChangeSet()

INTERNAL: Create a ChangeSet

UnitOfWorkChangeSetback to summary
public UnitOfWorkChangeSet(AbstractSession session)

INTERNAL: Create a ChangeSet

Method Detail

addDeletedObjectback to summary
public void addDeletedObject(Object object, AbstractSession session)

INTERNAL: Add the Deleted object to the changeSet.

addDeletedObjectsback to summary
public void addDeletedObjects(Map<K, V> deletedObjects, AbstractSession session)

INTERNAL: Add the Deleted objects to the changeSet.

addNewObjectChangeSetback to summary
protected void addNewObjectChangeSet(ObjectChangeSet objectChanges, AbstractSession session)

INTERNAL: Add to the changes for 'object' object to this changeSet. This method will not add to the lists that are used for identity lookups. It is called specifically for new objects, and new object will be moved to the standard changes list by the QueryMechanism after insert.

Parameters
objectChanges:ObjectChangeSet

the new object change set

See Also
addObjectChangeSetForIdentity(ObjectChangeSet, Object)
addObjectChangeSetback to summary
public void addObjectChangeSet(ObjectChangeSet objectChanges, AbstractSession session, boolean forceToNewObjectList)

INTERNAL: Add to the changes for 'object' object to this changeSet. This method will not add to the lists that are used for identity lookups. The passed change set *must* either have changes or forced changes.

Parameters
forceToNewObjectList:boolean

- Any pre commit actions should pass in true since new objects have extra-handling. Anything post commit, pass in false.

See Also
addObjectChangeSetForIdentity(ObjectChangeSet, Object)
addObjectChangeSetForIdentityback to summary
public void addObjectChangeSetForIdentity(ObjectChangeSet objectChanges, Object object)

INTERNAL: Add change records to the lists used to maintain identity. This will not actually add the changes to 'object' to the change set.

Parameters
objectChanges:ObjectChangeSet

prototype.changeset.ObjectChanges

See Also
addObjectChangeSet(ObjectChangeSet, AbstractSession, boolean)
buildCacheCoordinationMergeChangeSetback to summary
public UnitOfWorkChangeSet buildCacheCoordinationMergeChangeSet(AbstractSession session)

INTERNAL: Return a new UnitOfWorkChangeSet that only includes data require for the remote merge, for cache coordination.

Parameters
session:AbstractSession

current database session

ensureChangesback to summary
private void ensureChanges(final AbstractSession session, final ObjectChangeSet changeSet, final ClassDescriptor descriptor)

Ensure the change set is populated for cache coordination.

Parameters
session:AbstractSession

current database session

changeSet:ObjectChangeSet

change set to populate

descriptor:ClassDescriptor

class (relational) descriptor related to the change set

findObjectChangeSetback to summary
public ObjectChangeSet findObjectChangeSet(ObjectChangeSet changeSet, UnitOfWorkChangeSet mergeFromChangeSet)

INTERNAL: This method can be used find the equivalent changeset within this UnitOfWorkChangeSet Aggregates, and new objects without primaryKeys from serialized ChangeSets will not be found Which may result in duplicates, in the UnitOfWorkChangeSet.

findOrCreateLocalObjectChangeSetback to summary
public ObjectChangeSet findOrCreateLocalObjectChangeSet(Object entityClone, ClassDescriptor descriptor, boolean isNew)

INTERNAL" This method is used during the merge process to either find the existing ChangeSet or create a new one.

findOrIntegrateObjectChangeSetback to summary
public ObjectChangeSet findOrIntegrateObjectChangeSet(ObjectChangeSet tofind, UnitOfWorkChangeSet mergeFromChangeSet)

INTERNAL: This method will be used during the merge process to either find an equivalent change set within this UnitOfWorkChangeSet or integrate that changeset into this UOW ChangeSet

findUpdatedObjectsClassesback to summary
public Set<ClassDescriptor> findUpdatedObjectsClasses()

INTERNAL: Returns the set of classes corresponding to updated objects in objectChanges.

getAggregateChangeSetsback to summary
public Map<ObjectChangeSet, ObjectChangeSet> getAggregateChangeSets()

INTERNAL: Get the Aggregate list. Lazy initializes the map if required.

getAllChangeSetsback to summary
public Map<ObjectChangeSet, ObjectChangeSet> getAllChangeSets()

Implements org.eclipse.persistence.sessions.changesets.UnitOfWorkChangeSet.getAllChangeSets.

INTERNAL: This method returns a reference to the collection.

Returns:Map<ObjectChangeSet, ObjectChangeSet>

Doc from org.eclipse.persistence.sessions.changesets.UnitOfWorkChangeSet.getAllChangeSets.

Map

Annotations
@Override
getCloneToObjectChangeSetback to summary
public Map<Object, ObjectChangeSet> getCloneToObjectChangeSet()

INTERNAL: Get the clone to object change hash table. Lazy initializes the map if required.

getDeletedObjectsback to summary
public Map<ObjectChangeSet, ObjectChangeSet> getDeletedObjects()

Implements org.eclipse.persistence.sessions.changesets.UnitOfWorkChangeSet.getDeletedObjects.

INTERNAL: This method returns the reference to the deleted objects from the changeSet.

Returns:Map<ObjectChangeSet, ObjectChangeSet>

Doc from org.eclipse.persistence.sessions.changesets.UnitOfWorkChangeSet.getDeletedObjects.

Map

Annotations
@Override
getNewObjectChangeSetsback to summary
public Map<Class<?>, Map<ObjectChangeSet, ObjectChangeSet>> getNewObjectChangeSets()

INTERNAL: This method will return a reference to the new object change set collections.

getObjectChangesback to summary
public Map<Class<?>, Map<ObjectChangeSet, ObjectChangeSet>> getObjectChanges()

INTERNAL: Returns the ObjectChanges held by this ChangeSet.

getObjectChangeSetForCloneback to summary
public ObjectChangeSet getObjectChangeSetForClone(Object clone)

Implements org.eclipse.persistence.sessions.changesets.UnitOfWorkChangeSet.getObjectChangeSetForClone.

ADVANCED: Get ChangeSet for a particular clone

Returns:ObjectChangeSet

ObjectChangeSet the changeSet that represents a particular clone

Annotations
@Override
getObjectChangeSetToUOWCloneback to summary
protected Map<ObjectChangeSet, Object> getObjectChangeSetToUOWClone()

INTERNAL: This method returns a reference to the collection

Returns:Map<ObjectChangeSet, Object>

Map

getSessionback to summary
public AbstractSession getSession()

Return the session. This only exists before serialization.

getUOWCloneForObjectChangeSetback to summary
public Object getUOWCloneForObjectChangeSet(ObjectChangeSet changeSet)

Implements org.eclipse.persistence.sessions.changesets.UnitOfWorkChangeSet.getUOWCloneForObjectChangeSet.

ADVANCED: This method returns the Clone for a particular changeSet

Returns:Object

Object the clone represented by the changeSet

Annotations
@Override
hasChangesback to summary
public boolean hasChanges()

Implements org.eclipse.persistence.sessions.changesets.UnitOfWorkChangeSet.hasChanges.

INTERNAL: Returns true if the Unit Of Work change Set has changes

Returns:boolean

Doc from org.eclipse.persistence.sessions.changesets.UnitOfWorkChangeSet.hasChanges.

boolean

Annotations
@Override
hasDeletedObjectsback to summary
public boolean hasDeletedObjects()

INTERNAL: Returns true if any deleted objects. This should be used before accessing deleted object to avoid creation of map.

hasForcedChangesback to summary
public boolean hasForcedChanges()

INTERNAL: Returns true if this uowChangeSet contains an objectChangeSet that has forced SQL changes. This is true whenever CMPPolicy.getForceUpdate() == true.

Returns:boolean

boolean

isChangeSetFromOutsideUOWback to summary
public boolean isChangeSetFromOutsideUOW()

INTERNAL: Get the internal flag that tells that this change set was built outside this UOW and the changes it contains cannot be calculated from the contents of this UOW

mergeObjectChangesback to summary
public ObjectChangeSet mergeObjectChanges(ObjectChangeSet objectChangeSet, UnitOfWorkChangeSet mergeFromChangeSet)

INTERNAL: This method will be used to merge a change set into an UnitOfWorkChangeSet This method returns the local instance of the changeset

mergeUnitOfWorkChangeSetback to summary
public void mergeUnitOfWorkChangeSet(UnitOfWorkChangeSet mergeFromChangeSet, AbstractSession session, boolean postCommit)

INTERNAL: THis method will be used to merge another changeset into this changeset. The Main use of this method is for non-deferred writes and checkpointing so that the accumulated changes are collected and merged at the end of the transaction.

putNewObjectInChangesListback to summary
public void putNewObjectInChangesList(ObjectChangeSet objectChangeSet, AbstractSession session)

INTERNAL: Used to rehash the new objects back into the objectChanges list for serialization Assumes the transaction in in post commit stage.

removeObjectChangeSetback to summary
public void removeObjectChangeSet(ObjectChangeSet changeSet)

INTERNAL: Add the changed Object's records to the ChangeSet.

removeObjectChangeSetFromNewListback to summary
public void removeObjectChangeSetFromNewList(ObjectChangeSet objectChangeSet, AbstractSession session)

INTERNAL: Used to remove a new object from the new objects list once it has been inserted and added to the objectChangesList

setAllChangeSetsback to summary
public void setAllChangeSets(Map<K, V> allChangeSets)

INTERNAL: Sets the collection of ObjectChanges in the change Set.

setCloneToObjectChangeSetback to summary
public void setCloneToObjectChangeSet(Map<Object, ObjectChangeSet> cloneToObjectChangeSet)

INTERNAL: This method is used to set the map for cloneToObject reference.

setDeletedObjectsback to summary
public void setDeletedObjects(Map<K, V> deletedObjects)

INTERNAL: Sets the collection of deleted objects.

setHasChangesback to summary
public void setHasChanges(boolean flag)

INTERNAL: Set whether the Unit Of Work change Set has changes

setIsChangeSetFromOutsideUOWback to summary
public void setIsChangeSetFromOutsideUOW(boolean isChangeSetFromOutsideUOW)

INTERNAL: Set the internal flag that tells that this change set was built outside this UOW and the changes it contains cannot be calculated from the contents of this UOW

setObjectChangesback to summary
protected void setObjectChanges(Map<K, V> objectChanges)

INTERNAL: Sets the collection of ObjectChanges in the change Set.

setObjectChangeSetToUOWCloneback to summary
public void setObjectChangeSetToUOWClone(Map<ObjectChangeSet, Object> objectChangeSetToUOWClone)

INTERNAL: This method is used to insert a new collection into the UOWChangeSet.

setSessionback to summary
public void setSession(AbstractSession session)

INTERNAL: Set the session. This only exists before serialization.