result = Transaction.getCache().cache((DomainObject)result);
synchronized (TransactionChangeLogs.CHANGE_LOGS) {  Object cached = Transaction.getCache().cache((DomainObject)result);  if (cached == result) {  ((DomainObject)result).addKnownVersionsFromLogs(); } result = cached; }
    protected Object origBuildOrRefreshObject(Map row, ClassDescriptor targetClassDescriptor, Object targetObject) {        Object result = targetObject;        FieldDescriptor fmd = null;        if (targetObject == null) {            // 1. create new object instance if needed            result = ClassHelper.buildNewObjectInstance(targetClassDescriptor);	    // if it is a domain object	    if (targetClassDescriptor.getFactoryClass() == DomainAllocator.class) {		// read idInternal		fmd = targetClassDescriptor.getFieldDescriptorByName("idInternal");		fmd.getPersistentField().set(result, row.get(fmd.getColumnName()));				// cache object		result = Transaction.getCache().cache((DomainObject)result);	    }        }        // 2. fill all scalar attributes of the new object        FieldDescriptor[] fields = targetClassDescriptor.getFieldDescriptions();        for (int i = 0; i < fields.length; i++) {            fmd = fields[i];            fmd.getPersistentField().set(result, row.get(fmd.getColumnName()));        }        if(targetObject == null) {            // 3. for new build objects, invoke the initialization method for the class if one is provided            Method initializationMethod = targetClassDescriptor.getInitializationMethod();            if (initializationMethod != null) {		try {                    initializationMethod.invoke(result, NO_ARGS);                } catch (Exception ex) {                    throw new PersistenceBrokerException("Unable to invoke initialization method:" 							 + initializationMethod.getName() 							 + " for class:" 							 + targetClassDescriptor.getClassOfObject(), 							 ex);                }            }        }        return result;    }