docs: private static Criteria buildCriteria(Object anExample)
      {
          Criteria criteria = new Criteria();
          ClassDescriptor cld = MetadataManager.getInstance().getRepository().getDescriptorFor(anExample.getClass());
          FieldDescriptor[] fds = cld.getFieldDescriptions();
          PersistentField f;
          Object value;
  
          for (int i = 0; i < fds.length; i++)
          {
              try
              {
                  f = fds[i].getPersistentField();
                  value = f.get(anExample);
                  if (value != null)
                  {
                      criteria.addEqualTo(f.getName(), value);
                  }
              }
              catch (Throwable ex)
              {
                  LoggerFactory.getDefaultLogger().error(ex);
              }
          }
  
          return criteria;
      }