code: private void onDelete(Object entity, Object pKey, Object connection)
      {
          EntityMetadata entityMetadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, entity.getClass());
          AttributeWrapper wrapper = wrap(entityMetadata, entity);
  
          Set<byte[]> columnNames = wrapper.columns.keySet();
  
          String rowKey = null;
  
          MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
                  entityMetadata.getPersistenceUnit());
  
          if (metaModel.isEmbeddable(entityMetadata.getIdAttribute().getBindableJavaType()))
          {
              rowKey = KunderaCoreUtils.prepareCompositeKey(entityMetadata, pKey);
          }
          else
          {
              rowKey = PropertyAccessorHelper.getString(entity, (Field) entityMetadata.getIdAttribute().getJavaMember());
          }
  
          for (byte[] name : columnNames)
          {
              if (resource != null && resource.isActive())
              {
                  ((Transaction) connection).hdel(getHashKey(entityMetadata.getTableName(), rowKey),
                          PropertyAccessorFactory.STRING.fromBytes(String.class, name));
  
              }
              else
              {
                  ((Pipeline) connection).hdel(getHashKey(entityMetadata.getTableName(), rowKey),
                          PropertyAccessorFactory.STRING.fromBytes(String.class, name));
  
              }
          }
  
          // Delete relation values.
  
          deleteRelation(connection, entityMetadata, rowKey);
  
          // Delete inverted indexes.
          unIndex(connection, wrapper, rowKey);
  
          if (resource != null && resource.isActive())
          {
              ((Transaction) connection).zrem(
                      getHashKey(entityMetadata.getTableName(),
                              ((AbstractAttribute) entityMetadata.getIdAttribute()).getJPAColumnName()), rowKey);
  
          }
          else
          {
              ((Pipeline) connection).zrem(
                      getHashKey(entityMetadata.getTableName(),
                              ((AbstractAttribute) entityMetadata.getIdAttribute()).getJPAColumnName()), rowKey);
  
          }
          KunderaCoreUtils.printQuery("Delete data from:" + entityMetadata.getTableName() + "for primary key: " + rowKey,
                  showQuery);
      }
docs: On delete.
  
  @param entity
  the entity
  @param pKey
  the key
  @param connection
  the connection