code: public static DBObject getDBObject(EntityMetadata m, String tableName, Map<String, DBObject> dbObjects,
              MetamodelImpl metaModel, Object id)
      {
          tableName = tableName != null ? tableName : m.getTableName();
          DBObject dbObj = dbObjects.get(tableName);
          if (dbObj == null)
          {
              dbObj = new BasicDBObject();
              dbObjects.put(tableName, dbObj);
          }
  
          if (metaModel.isEmbeddable(m.getIdAttribute().getBindableJavaType()))
          {
              MongoDBUtils.populateCompoundKey(dbObj, m, metaModel, id);
          }
          else
          {
              dbObj.put("_id", MongoDBUtils.populateValue(id, id.getClass()));
          }
          return dbObj;
      }
docs: Gets the DB object.
  
  @param m
  the m
  @param tableName
  the table name
  @param dbObjects
  the db objects
  @param metaModel
  the meta model
  @param id
  the id
  @return the DB object