code: public Object getEntityFromGFSDBFile(Class<?> entityClazz, Object entity, EntityMetadata m, GridFSDBFile outputFile,
              KunderaMetadata kunderaMetadata)
      {
          MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata()
                  .getMetamodel(m.getPersistenceUnit());
          String id = ((AbstractAttribute) m.getIdAttribute()).getJPAColumnName();
          Object rowKey = ((DBObject) outputFile.get(MongoDBUtils.METADATA)).get(id);
          Class<?> rowKeyValueClass = rowKey.getClass();
          Class<?> idClass = m.getIdAttribute().getJavaType();
          rowKey = MongoDBUtils.populateValue(rowKey, idClass);
          rowKey = MongoDBUtils.getTranslatedObject(rowKey, rowKeyValueClass, idClass);
          PropertyAccessorHelper.setId(entity, m, rowKey);
          EntityType entityType = metaModel.entity(entityClazz);
  
          Set<Attribute> columns = entityType.getAttributes();
          for (Attribute column : columns)
          {
              boolean isLob = ((Field) column.getJavaMember()).getAnnotation(Lob.class) != null;
              if (isLob)
              {
                  if (column.getJavaType().isAssignableFrom(byte[].class))
                  {
                      InputStream is = outputFile.getInputStream();
                      try
                      {
                          PropertyAccessorHelper.set(entity, (Field) column.getJavaMember(), ByteStreams.toByteArray(is));
                      }
                      catch (IOException e)
                      {
                          log.error("Error while converting inputstream from GridFSDBFile to byte array, Caused by: ", e);
                          throw new KunderaException(
                                  "Error while converting inputstream from GridFSDBFile to byte array, Caused by: ", e);
                      }
                  }
              }
              else if (!column.equals(m.getIdAttribute()))
                  DocumentObjectMapper.setFieldValue(outputFile, entity, column, true);
          }
          return entity;
      }
docs: Gets the entity from GFSDBFile.
  
  @param entityClazz
  the entity clazz
  @param entity
  the entity
  @param m
  the m
  @param outputFile
  the output file
  @param kunderaMetadata
  the kundera metadata
  @return the entity from GFSDBFile