code: @Override
      public JsonDocument getDocumentFromEntity(EntityMetadata entityMetadata, Object entity,
              KunderaMetadata kunderaMetadata)
      {
  
          MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata()
                  .getMetamodel(entityMetadata.getPersistenceUnit());
          Class entityClazz = entityMetadata.getEntityClazz();
          EntityType entityType = metaModel.entity(entityClazz);
          Set<Attribute> attributes = entityType.getAttributes();
          Iterator<Attribute> iterator = attributes.iterator();
          JsonObject obj = iterateAndPopulateJsonObject(entity, iterator, entityMetadata.getTableName());
          Object id = PropertyAccessorHelper.getId(entity, entityMetadata);
          return JsonDocument.create(entityMetadata.getTableName() + CouchbaseConstants.ID_SEPARATOR + id.toString(),
                  obj);
      }
docs: /*
  (non-Javadoc)
  
  @see
  com.impetus.client.couchbase.CouchbaseDataHandler#getDocumentFromEntity(
  com.impetus.kundera.metadata.model.EntityMetadata, java.lang.Object,
  com.impetus.kundera.persistence.EntityManagerFactoryImpl.KunderaMetadata)