code: static void extractFieldValue(Object entity, DBObject dbObj, Attribute column) throws PropertyAccessException
      {
          try
          {
              Object valueObject = PropertyAccessorHelper.getObject(entity, (Field) column.getJavaMember());
  
              if (valueObject != null)
              {
                  Class javaType = column.getJavaType();
                  switch (AttributeType.getType(javaType))
                  {
                  case MAP:
                      Map mapObj = (Map) valueObject;
                      // BasicDBObjectBuilder builder =
                      // BasicDBObjectBuilder.start(mapObj);
                      BasicDBObjectBuilder b = new BasicDBObjectBuilder();
                      Iterator i = mapObj.entrySet().iterator();
                      while (i.hasNext())
                      {
                          Map.Entry entry = (Map.Entry) i.next();
                          b.add(entry.getKey().toString(),
                                  MongoDBUtils.populateValue(entry.getValue(), entry.getValue().getClass()));
                      }
                      dbObj.put(((AbstractAttribute) column).getJPAColumnName(), b.get());
                      break;
                  case SET:
                  case LIST:
                      Collection collection = (Collection) valueObject;
                      BasicDBList basicDBList = new BasicDBList();
                      for (Object o : collection)
                      {
                          basicDBList.add(o);
                      }
                      dbObj.put(((AbstractAttribute) column).getJPAColumnName(), basicDBList);
                      break;
                  case POINT:
  
                      Point p = (Point) valueObject;
                      double[] coordinate = new double[] { p.getX(), p.getY() };
                      dbObj.put(((AbstractAttribute) column).getJPAColumnName(), coordinate);
                      break;
                  case ENUM:
                  case PRIMITIVE:
                      dbObj.put(((AbstractAttribute) column).getJPAColumnName(),
                              MongoDBUtils.populateValue(valueObject, javaType));
                      break;
                  }
              }
          }
          catch (PropertyAccessException paex)
          {
              log.error("Error while getting column {} value, caused by : .",
                      ((AbstractAttribute) column).getJPAColumnName(), paex);
              throw new PersistenceException(paex);
          }
      }
docs: Extract entity field.
  
  @param entity
  the entity
  @param dbObj
  the db obj
  @param column
  the column
  @throws PropertyAccessException
  the property access exception