@Override public boolean willWrite(DataObject target, Object value) { Object oldValue = property.readProperty(target); return !Util.nullSafeEquals(oldValue, value); } }
@Override public boolean visitToOne(ToOneProperty property) { boolean isUsedForLocking = entity.getRelationship(property.getName()).isUsedForLocking(); // eagerly resolve optimistically locked relationships Object target = isUsedForLocking ? property.readProperty(object) : property.readPropertyDirectly(object); if (target instanceof Persistent) { target = ((Persistent) target).getObjectId(); } // else - null || Fault arcSnapshot.put(property.getName(), target); return true; } });
public boolean visitToOne(ToOneProperty property) { if (!property.isFault(peerInParentContext)) { Persistent destinationSource = (Persistent) property .readProperty(peerInParentContext); Object destinationTarget = destinationSource != null ? merge( destinationSource, property.getTargetDescriptor(), seen) : null; Object oldTarget = property.isFault(target) ? null : property .readProperty(target); property.writePropertyDirectly(target, oldTarget, destinationTarget); } return true; }
public boolean visitToOne(ToOneProperty property) { if (prefetchTree != null) { PrefetchTreeNode child = prefetchTree.getNode(property.getName()); if (child != null) { Object destinationSource = property.readProperty(source); Object destinationTarget = destinationSource != null ? detach( destinationSource, property.getTargetDescriptor(), child) : null; if (destinationTarget != null) { fillReverseRelationship(destinationTarget, property); } ToOneProperty targetProperty = (ToOneProperty) targetDescriptor .getProperty(property.getName()); Object oldTarget = targetProperty.isFault(target) ? null : targetProperty.readProperty(target); targetProperty .writeProperty(target, oldTarget, destinationTarget); } } return true; }