* @see {@link Operation}
*/
@Override
public Object invoke(XRServiceAdapter xrService, Invocation invocation) {
XRDynamicEntity instance = (XRDynamicEntity)invocation.getParameters().toArray()[0];
UnitOfWork uow = xrService.getORSession().acquireUnitOfWork();
ReadObjectQuery query = new ReadObjectQuery();
query.setSelectionObject(instance);
query.setIsExecutionClone(true);
FetchGroup simpleFetchGroup = new FetchGroup();
for (String propertyName : instance.fetchPropertiesManager().getPropertyNames()) {
if (instance.isSet(propertyName)) {
simpleFetchGroup.addAttribute(propertyName);
}
}
query.setFetchGroup(simpleFetchGroup);
// read the existing object into the uow
uow.executeQuery(query);
// merge in only properties that are set
uow.mergeClone(instance);
uow.commit();
return null;
}