descriptor.visitProperties(new PropertyVisitor() {
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;
ToOneProperty targetProperty = (ToOneProperty) targetDescriptor
.getProperty(property.getName());
Object oldTarget = targetProperty.isFault(target)
? null
: targetProperty.readProperty(target);
targetProperty
.writeProperty(target, oldTarget, destinationTarget);
}
}
return true;
}
public boolean visitToMany(ToManyProperty property) {
if (prefetchTree != null) {
PrefetchTreeNode child = prefetchTree.getNode(property.getName());
if (child != null) {
Collection collection = (Collection) property
.readProperty(source);