code: private Object populateEntityFromDataFrame(EntityMetadata m, Map<String, Integer> columnIndexMap, Row row)
      {
          try
          {
              // create entity instance
              Object entity = KunderaCoreUtils.createNewInstance(m.getEntityClazz());
              // handle relations
              Map<String, Object> relations = new HashMap<String, Object>();
              if (entity.getClass().isAssignableFrom(EnhanceEntity.class))
              {
                  relations = ((EnhanceEntity) entity).getRelations();
                  entity = ((EnhanceEntity) entity).getEntity();
              }
              // get a Set of attributes
              MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
                      m.getPersistenceUnit());
              EntityType entityType = metaModel.entity(m.getEntityClazz());
              Set<Attribute> attributes = ((AbstractManagedType) entityType).getAttributes();
              // iterate over attributes and find its value
              for (Attribute attribute : attributes)
              {
                  String columnName = getColumnName(attribute);
                  Object columnValue = row.get(columnIndexMap.get(columnName));
                  if (columnValue != null)
                  {
                      Object value = PropertyAccessorHelper.fromSourceToTargetClass(attribute.getJavaType(),
                              columnValue.getClass(), columnValue);
  
                      PropertyAccessorHelper.set(entity, (Field) attribute.getJavaMember(), value);
                  }
              }
              // find the value of @Id field for EnhanceEntity
              SingularAttribute attrib = m.getIdAttribute();
              Object rowKey = PropertyAccessorHelper.getObject(entity, (Field) attrib.getJavaMember());
              if (!relations.isEmpty())
              {
                  return new EnhanceEntity(entity, rowKey, relations);
              }
              return entity;
          }
          catch (PropertyAccessException e1)
          {
              throw new RuntimeException(e1);
          }
      }
docs: Populate entity from data frame.
  
  @param m
  the m
  @param columnIndexMap
  the column index map
  @param row
  the row
  @return the object