String className = (String) source.get(CLASS_NAME_STR);
ClassDescriptor cld = broker.getDescriptorRepository().getDescriptorFor(className);
Object target = ClassHelper.buildNewObjectInstance(cld);
// perform main object values
FieldDescriptor[] flds = cld.getFieldDescriptions();
FieldDescriptor fld = null;
for(int i = 0; i < flds.length; i++)
{
fld = flds[i];
// read the field value
Object value = source.get(fld.getPersistentField().getName());
// copy the field value
value = fld.getJdbcType().getFieldType().copy(value);
// now make a field-conversion to java-type, because we only
// the sql type of the field
value = fld.getFieldConversion().sqlToJava(value);
// set the copied field value in new object
fld.getPersistentField().set(target, value);
}
return target;
}