code: public List list(Class clazz, String key, Object value)
      {
          EntityManager entityManager = null;
          try {
              entityManager = entityManagers.poll();
  
              Query query = entityManager.createQuery("SELECT c FROM " + clazz.getCanonicalName() + " c where c." + key + " = :param");
              query.setParameter("param", value);
              return query.getResultList();
  
          } catch (Exception e) {
              e.printStackTrace();
          }
          finally {
              if(entityManager != null)
                  entityManagers.add(entityManager);
          }
  
          return null;
      }
docs: Execute query with criteria of key = key.  This will auto generate a sql statement.
  
  @param clazz Entity to query
  @param key Attribute to predicate upon
  @param value Attribute key to predicate upon
  @return List of entities that match the criteria