code: private AttributeWrapper wrap(EntityMetadata entityMetadata, Object entity)
      {
          MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
                  entityMetadata.getPersistenceUnit());
  
          EntityType entityType = metaModel.entity(entityMetadata.getEntityClazz());
          Set<Attribute> attributes = entityType.getAttributes();
  
          // attributes can be null??? i guess NO
          AttributeWrapper wrapper = new AttributeWrapper(attributes.size());
  
          List<String> relationNames = entityMetadata.getRelationNames();
  
          // PropertyAccessorHelper.get(entity,
          for (Attribute attr : attributes)
          {
              if (/* !entityMetadata.getIdAttribute().equals(attr) && */!attr.isAssociation())
              {
                  if (metaModel.isEmbeddable(((AbstractAttribute) attr).getBindableJavaType()))
                  {
                      EmbeddableType embeddableAttribute = metaModel.embeddable(((AbstractAttribute) attr)
                              .getBindableJavaType());
  
                      Object embeddedObject = PropertyAccessorHelper.getObject(entity, (Field) attr.getJavaMember());
  
                      Set<Attribute> embeddedAttributes = embeddableAttribute.getAttributes();
  
                      for (Attribute attrib : embeddedAttributes)
                      {
                          addToWrapper(entityMetadata, wrapper, embeddedObject, attrib, attr);
                      }
  
                  }
                  else
                  {
                      addToWrapper(entityMetadata, wrapper, entity, attr);
                  }
              }
              else if (attributes.size() == 1) // means it is only a key! weird
                                               // but possible negative
                                               // scenario
              {
                  byte[] value = PropertyAccessorHelper.get(entity, (Field) attr.getJavaMember());
                  byte[] name;
                  name = getEncodedBytes(((AbstractAttribute) attr).getJPAColumnName());
  
                  // add column name as key and value as value
                  wrapper.addColumn(name, value);
  
              }
          }
  
          return wrapper;
      }
docs: Wraps entity attributes into byte[] and return instance of attribute
  wrapper.
  
  @param entityMetadata
  @param entity
  @return