code: public static String prepareCompositeKey(final EntityMetadata m, final Object compositeKey)
      {
          Field[] fields = m.getIdAttribute().getBindableJavaType().getDeclaredFields();
  
          StringBuilder stringBuilder = new StringBuilder();
          for (Field f : fields)
          {
              if (!ReflectUtils.isTransientOrStatic(f))
              {
                  try
                  {
                      String fieldValue = PropertyAccessorHelper.getString(compositeKey, f);
  
                      // what if field value is null????
                      stringBuilder.append(fieldValue);
                      stringBuilder.append(COMPOSITE_KEY_SEPERATOR);
                  }
                  catch (IllegalArgumentException e)
                  {
                      logger.error("Error during prepare composite key, Caused by {}.", e);
                      throw new PersistenceException(e);
                  }
              }
          }
  
          if (stringBuilder.length() > 0)
          {
              stringBuilder.deleteCharAt(stringBuilder.lastIndexOf(COMPOSITE_KEY_SEPERATOR));
          }
          return stringBuilder.toString();
      }
docs: Prepares composite key .
  
  @param m
  entity metadata
  @param compositeKey
  composite key instance
  @return redis key