docs: @Deprecated
      public <T> T fromDb(final Datastore datastore, final DBObject dbObject, final T entity, final EntityCache cache) {
          //hack to bypass things and just read the value.
          if (entity instanceof MappedField) {
              readMappedField(datastore, (MappedField) entity, entity, cache, dbObject);
              return entity;
          }
  
          // check the history key (a key is the namespace + id)
  
          if (dbObject.containsField("_id") && getMappedClass(entity).getIdField() != null
              && getMappedClass(entity).getEntityAnnotation() != null) {
              final Key<T> key = new Key(entity.getClass(), getCollectionName(entity.getClass()), dbObject.get("_id"));
              final T cachedInstance = cache.getEntity(key);
              if (cachedInstance != null) {
                  return cachedInstance;
              } else {
                  cache.putEntity(key, entity); // to avoid stackOverflow in recursive refs
              }
          }
  
          if (entity instanceof Map) {
              Map<String, Object> map = (Map<String, Object>) entity;
              for (String key : dbObject.keySet()) {
                  Object o = dbObject.get(key);
                  map.put(key, (o instanceof DBObject) ? fromDBObject(datastore, (DBObject) o) : o);
              }
          } else if (entity instanceof Collection) {
              Collection<Object> collection = (Collection<Object>) entity;
              for (Object o : ((List) dbObject)) {
                  collection.add((o instanceof DBObject) ? fromDBObject(datastore, (DBObject) o) : o);
              }
          } else {
              final MappedClass mc = getMappedClass(entity);
              final DBObject updated = mc.callLifecycleMethods(PreLoad.class, entity, dbObject, this);
              try {
                  for (final MappedField mf : mc.getPersistenceFields()) {
                      readMappedField(datastore, mf, entity, cache, updated);
                  }
              } catch (final MappingException e) {
                  Object id = dbObject.get("_id");
                  String entityName = entity.getClass().getName();
                  throw new MappingException(format("Could not map %s with ID: %s in database '%s'", entityName, id,
                      datastore.getDB().getName()), e);
              }
  
              if (updated.containsField("_id") && getMappedClass(entity).getIdField() != null) {
                  final Key key = new Key(entity.getClass(), getCollectionName(entity.getClass()), updated.get("_id"));
                  cache.putEntity(key, entity);
              }
              mc.callLifecycleMethods(PostLoad.class, entity, updated, this);
          }
          return entity;
      }