object/src/main/java/com/orientechnologies/orient/object/enhancement/OObjectProxyMethodHandler.java
public void attach(final Object self)
      throws IllegalArgumentException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {
    for (Class<?> currentClass = self.getClass(); currentClass != Object.class; ) {
      if (Proxy.class.isAssignableFrom(currentClass)) {
        currentClass = currentClass.getSuperclass();
        continue;
      }
      for (Field f : currentClass.getDeclaredFields()) {
        final String fieldName = f.getName();
        final Class<?> declaringClass = f.getDeclaringClass();

        if (OObjectEntitySerializer.isTransientField(declaringClass, fieldName) || OObjectEntitySerializer
            .isVersionField(declaringClass, fieldName) || OObjectEntitySerializer.isIdField(declaringClass, fieldName))
          continue;

        Object value = OObjectEntitySerializer.getFieldValue(f, self);
        value = setValue(self, fieldName, value);
        OObjectEntitySerializer.setFieldValue(f, self, value);
      }
      currentClass = currentClass.getSuperclass();

      if (currentClass == null || currentClass.equals(ODocument.class))
        // POJO EXTENDS ODOCUMENT: SPECIAL CASE: AVOID TO CONSIDER
        // ODOCUMENT FIELDS
        currentClass = Object.class;
    }
  }
public void attach(final Object self)
      throws IllegalArgumentException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {
    for (Class<?> currentClass = self.getClass(); currentClass != Object.class; ) {
      if (Proxy.class.isAssignableFrom(currentClass)) {
        currentClass = currentClass.getSuperclass();
        continue;
      }
      for (Field f : currentClass.getDeclaredFields()) {
        final String fieldName = f.getName();
        final Class<?> declaringClass = f.getDeclaringClass();

        if (OObjectEntitySerializer.isTransientField(declaringClass, fieldName) || OObjectEntitySerializer
            .isVersionField(declaringClass, fieldName) || OObjectEntitySerializer.isIdField(declaringClass, fieldName))
          continue;

        Object value = OObjectEntitySerializer.getFieldValue(f, self);
        value = setValue(self, fieldName, value);
        OObjectEntitySerializer.setFieldValue(f, self, value);
      }
      currentClass = currentClass.getSuperclass();

      if (currentClass == null || currentClass.equals(ODocument.class))
        // POJO EXTENDS ODOCUMENT: SPECIAL CASE: AVOID TO CONSIDER
        // ODOCUMENT FIELDS
        currentClass = Object.class;
    }
  }
Method that attaches all data contained in the object to the associated document

@param self :- The object containing this handler instance

@throws IllegalAccessException
@throws IllegalArgumentException
@throws InvocationTargetException
@throws NoSuchMethodException