public static Identifiable findUnique(
     Class<? extends Identifiable> clazz, String field, Object value) throws PersistenceException {
   final OqlQuery oqlQuery =
       new OqlQuery("from " + clazz.getName() + " as obj where obj." + field + " = :aparam");
   try {
     return (Identifiable) oqlQuery.getQuery().setParameter("aparam", value).uniqueResult();
   } catch (HibernateException e) {
     throw new PersistenceException(oqlQuery.doDebug(new Object[] {value}), e);
   }
 }
 public static Object findUniqueObject(
     Class clazz, String field, Object value, PersistenceContext pc) throws PersistenceException {
   final OqlQuery oqlQuery =
       new OqlQuery("from " + clazz.getName() + " as obj where obj." + field + " = :aparam", pc);
   try {
     return oqlQuery.getQuery().setParameter("aparam", value).uniqueResult();
   } catch (HibernateException e) {
     throw new PersistenceException(oqlQuery.doDebug(new Object[] {value}), e);
   }
 }
 public static Identifiable findFirst(
     Class<? extends Identifiable> clazz, String field, Object value) throws PersistenceException {
   final OqlQuery oqlQuery =
       new OqlQuery("from " + clazz.getName() + " as obj where obj." + field + " = :aparam");
   oqlQuery.getQuery().setMaxResults(1);
   try {
     List list = oqlQuery.getQuery().setParameter("aparam", value).list();
     if (JSP.ex(list)) return (Identifiable) list.get(0);
     else return null;
   } catch (HibernateException e) {
     throw new PersistenceException(oqlQuery.doDebug(new Object[] {value}), e);
   }
 }