/** * INTERNAL: * Query the cache in-memory. * If the object is not found null is returned. * If the expression is too complex an exception will be thrown. */ public Object getFromIdentityMap(Expression selectionCriteria, Class theClass, Record translationRow, InMemoryQueryIndirectionPolicy valueHolderPolicy, boolean conforming) { return getFromIdentityMap(selectionCriteria, theClass, translationRow, valueHolderPolicy, conforming, true, getSession().getDescriptor(theClass)); }
/** * ADVANCED: * Extract the write lock value from the identity map. */ public Object getWriteLockValue(Vector primaryKey, Class theClass) { return getWriteLockValue(primaryKey, theClass, getSession().getDescriptor(theClass)); }
/** * ADVANCED: * Remove the object from the object cache. */ public Object removeFromIdentityMap(Vector key, Class theClass) { ClassDescriptor descriptor = getSession().getDescriptor(theClass); return removeFromIdentityMap(key, theClass, descriptor); }
/** * Determine if the object is a registered new object, and that this is a nested unit of work * merge into the parent. In this case private mappings will register the object as being removed. */ public void registerRemovedNewObjectIfRequired(Object removedObject) { if (getSession().isUnitOfWork()) { UnitOfWorkImpl unitOfWork = (UnitOfWorkImpl)getSession(); if (shouldMergeWorkingCopyIntoOriginal() && unitOfWork.getParent().isUnitOfWork() && unitOfWork.isCloneNewObject(removedObject)) { Object originalVersionOfRemovedObject = unitOfWork.getOriginalVersionOfObject(removedObject); unitOfWork.addRemovedObject(originalVersionOfRemovedObject); } } }
/** * INTERNAL: * This is internal to the uow, transactions should not be used explictly in a uow. * The uow shares its parents transactions. */ public void rollbackTransaction() throws DatabaseException { incrementProfile(SessionProfiler.UowRollbacks); getParent().rollbackTransaction(); }
/** * INTERNAL: * This method will be used to update the objectsChangeSets references */ public void updateReferences(UnitOfWorkChangeSet mergeToChangeSet, UnitOfWorkChangeSet mergeFromChangeSet) { this.setNewValue(mergeToChangeSet.findOrIntegrateObjectChangeSet((ObjectChangeSet)this.getNewValue(), mergeFromChangeSet)); } }
/** * INTERNAL: */ protected void registerRemoveNewObjectIfRequired(ObjectChangeSet objectChanges, MergeManager mergeManager) { if (! mergeManager.shouldMergeChangesIntoDistributedCache()) { mergeManager.registerRemovedNewObjectIfRequired(objectChanges.getUnitOfWorkClone()); } }
/** * INTERNAL: * The uow does not store a local accessor but shares its parents. */ public Accessor getAccessor() { return getParent().getAccessor(); }
/** * INTERNAL: * This method will be used to merge a change set into an UnitOfWorkChangeSet * This method returns the local instance of the changeset */ public ObjectChangeSet mergeObjectChanges(ObjectChangeSet objectChangeSet, UnitOfWorkChangeSet mergeFromChangeSet) { ObjectChangeSet localChangeSet = this.findOrIntegrateObjectChangeSet(objectChangeSet, mergeFromChangeSet); if (localChangeSet != null) { localChangeSet.mergeObjectChanges(objectChangeSet, this, mergeFromChangeSet); } return localChangeSet; }
/** * PUBLIC: * Return the descriptor for the alias. * UnitOfWork delegates this to the parent * Introduced because of Bug#2610803 */ public ClassDescriptor getDescriptorForAlias(String alias) { return getParent().getDescriptorForAlias(alias); }
/** * PUBLIC: * Return all registered descriptors. * The unit of work inherits its parent's descriptors. The each descriptor's Java Class * is used as the key in the Hashtable returned. */ public Map getDescriptors() { return getParent().getDescriptors(); }
/** * INTERNAL: * Marked internal as this is not customer API but helper methods for * accessing the server platform from within TopLink's other sessions types * (ie not DatabaseSession) */ public ServerPlatform getServerPlatform(){ return getParent().getServerPlatform(); }
/** * INTERNAL: * Return the platform for a particular class. */ public Platform getPlatform(Class domainClass) { return getParent().getPlatform(domainClass); }
/** * PUBLIC: * Return whether the session currently has a database transaction in progress. */ public boolean isInTransaction() { return getParent().isInTransaction(); }
/** * INTERNAL: * Used to update a changeRecord that is stored in the CHangeSet with a new value. */ public void updateChangeRecordForAttribute(String attributeName, Object value) { ChangeRecord changeRecord = (ChangeRecord)getChangesForAttributeNamed(attributeName); if (changeRecord != null) { changeRecord.updateChangeRecordWithNewValue(value); } }
/** * INTERNAL: * This is internal to the uow, transactions should not be used explictly in a uow. * The uow shares its parents transactions. */ public void beginTransaction() throws DatabaseException { getParent().beginTransaction(); }
/** * INTERNAL: * Write all of the objects and all of their privately owned parts in the database. * The allows for a group of new objects to be commited as a unit. * The objects will be commited through a single transactions and any * foreign keys/circular references between the objects will be resolved. */ protected void writeAllObjects(IdentityHashtable domainObjects) throws DatabaseException, OptimisticLockException { getCommitManager().commitAllObjects(domainObjects); }
/** * INTERNAL: * This method will be used to merge one record into another */ public void mergeRecord(ChangeRecord mergeFromRecord, UnitOfWorkChangeSet mergeToChangeSet, UnitOfWorkChangeSet mergeFromChangeSet) { ObjectChangeSet localChangeSet = mergeToChangeSet.findOrIntegrateObjectChangeSet((ObjectChangeSet)((ObjectReferenceChangeRecord)mergeFromRecord).getNewValue(), mergeFromChangeSet); this.newValue = localChangeSet; }
/** * ADVANCED: * Return the object from the identity with the primary and class. * Only return invalidated objects if requested. */ public Object getFromIdentityMap(Vector primaryKey, Class theClass, boolean shouldReturnInvalidatedObjects) { return getFromIdentityMap(primaryKey, theClass, shouldReturnInvalidatedObjects, getSession().getDescriptor(theClass)); }
/** * INTERNAL: * The uow does not store a local accessor but shares its parents. */ public Accessor getAccessor(String sessionName) { return getParent().getAccessor(sessionName); }