/** * INTERNAL: * Return true if the Object should be compared, false otherwise. In ObjectChangeTrackingPolicy or * AttributeChangeTracking Policy this method will return true if the object is new, if the object * is in the OptimisticReadLock list or if the listener.hasChanges() returns true. * @param object the object that will be compared * @param unitOfWork the active unitOfWork * @param descriptor the descriptor for the current object */ public boolean shouldCompareExistingObjectForChange(Object object, UnitOfWorkImpl unitOfWork, ClassDescriptor descriptor) { //PERF: Breakdown the logic to have the most likely scenario checked first ObjectChangeListener listener = (ObjectChangeListener)((ChangeTracker)object)._persistence_getPropertyChangeListener(); if ((listener != null) && listener.hasChanges()) { return true; } Boolean optimisticRead = null; if (unitOfWork.hasOptimisticReadLockObjects()) { optimisticRead = (Boolean)unitOfWork.getOptimisticReadLockObjects().get(object); // Need to always compare/build change set for new objects and those that are being forced to // updated (opt. read lock and forceUpdate) if (optimisticRead != null) { return true; } } if ((descriptor.getCMPPolicy() != null) && descriptor.getCMPPolicy().getForceUpdate()) { return true; } return false; }
/** * INTERNAL: * Return true if the Object should be compared, false otherwise. In ObjectChangeTrackingPolicy or * AttributeChangeTracking Policy this method will return true if the object is new, if the object * is in the OptimisticReadLock list or if the listener.hasChanges() returns true. * @param object the object that will be compared * @param unitOfWork the active unitOfWork * @param descriptor the descriptor for the current object */ public boolean shouldCompareExistingObjectForChange(Object object, UnitOfWorkImpl unitOfWork, ClassDescriptor descriptor) { //PERF: Breakdown the logic to have the most likely scenario checked first ObjectChangeListener listener = (ObjectChangeListener)((ChangeTracker)object)._persistence_getPropertyChangeListener(); if ((listener != null) && listener.hasChanges()) { return true; } Boolean optimisticRead = null; if (unitOfWork.hasOptimisticReadLockObjects()) { optimisticRead = (Boolean)unitOfWork.getOptimisticReadLockObjects().get(object); // Need to always compare/build change set for new objects and those that are being forced to // updated (opt. read lock and forceUpdate) if (optimisticRead != null) { return true; } } if ((descriptor.getCMPPolicy() != null) && descriptor.getCMPPolicy().getForceUpdate()) { return true; } return false; }
/** * INTERNAL: * Return true if the Object should be compared, false otherwise. In ObjectChangeTrackingPolicy or * AttributeChangeTracking Policy this method will return true if the object is new, if the object * is in the OptimisticReadLock list or if the listener.hasChanges() returns true. * @param object the object that will be compared * @param unitOfWork the active unitOfWork * @param descriptor the descriptor for the current object */ public boolean shouldCompareExistingObjectForChange(Object object, UnitOfWorkImpl unitOfWork, ClassDescriptor descriptor) { //PERF: Breakdown the logic to have the most likely scenario checked first ObjectChangeListener listener = (ObjectChangeListener)((ChangeTracker)object)._persistence_getPropertyChangeListener(); if ((listener != null) && listener.hasChanges()) { return true; } Boolean optimisticRead = null; if (unitOfWork.hasOptimisticReadLockObjects()) { optimisticRead = (Boolean)unitOfWork.getOptimisticReadLockObjects().get(object); // Need to always compare/build change set for new objects and those that are being forced to // updated (opt. read lock and forceUpdate) if (optimisticRead != null) { return true; } } if ((descriptor.getCMPPolicy() != null) && descriptor.getCMPPolicy().getForceUpdate()) { return true; } return false; }