object/src/main/java/com/orientechnologies/orient/core/entity/OEntityManager.java
public synchronized void registerEntityClasses(Class<?> aClass, boolean recursive) {
    if (recursive) {
      classHandler.registerEntityClass(aClass);
      Field[] declaredFields = aClass.getDeclaredFields();
      for (Field declaredField : declaredFields) {
        Class<?> declaredFieldType = declaredField.getType();
        if (!classHandler.containsEntityClass(declaredFieldType)) {
          registerEntityClasses(declaredFieldType, recursive);
        }
      }
    } else {
      classHandler.registerEntityClass(aClass);
    }
  }
public synchronized void registerEntityClasses(Class<?> aClass, boolean recursive) {
    if (recursive) {
      classHandler.registerEntityClass(aClass);
      Field[] declaredFields = aClass.getDeclaredFields();
      for (Field declaredField : declaredFields) {
        Class<?> declaredFieldType = declaredField.getType();
        if (!classHandler.containsEntityClass(declaredFieldType)) {
          registerEntityClasses(declaredFieldType, recursive);
        }
      }
    } else {
      classHandler.registerEntityClass(aClass);
    }
  }
Scans all classes accessible from the context class loader which belong to the given class and all it's attributes - classes.

@param aClass
The class to start from
@param recursive
Beginning from the class, it will register all classes that are direct or indirect a attribute class