public <T> T newObj(Class<T> c) {
   try {
     return newObj(c.getConstructor().newInstance());
   } catch (Exception e) {
     LOG.warning(e);
   }
   return null;
 }
 public <T> T saveObj(T obj) {
   PersistenceManager pm = pmf.getPersistenceManager();
   try {
     return pm.makePersistent(obj);
   } catch (Throwable e) {
     LOG.warning(e);
   } finally {
     pm.close();
   }
   return obj;
 }
 public <T> T getArbitrary(Class<T> classObj) {
   PersistenceManager pm = pmf.getPersistenceManager();
   try {
     Extent<T> result = pm.getExtent(classObj, false);
     return result.iterator().next();
   } catch (Throwable e) {
     LOG.warning(e);
   } finally {
     pm.close();
   }
   return null;
 }
 public <T> List<T> getAll(Class<T> c) {
   PersistenceManager pm = pmf.getPersistenceManager();
   try {
     Extent<T> result = pm.getExtent(c, false);
     List<T> buffer = new ArrayList<T>();
     for (T t : result) {
       buffer.add(t);
     }
     return buffer;
   } catch (Throwable e) {
     LOG.warning(e);
   } finally {
     pm.close();
   }
   return new ArrayList<T>();
 }
 public <T> List<T> getQuery(
     Class<T> c, String queryString, String parameterDeclaration, Object... parameters) {
   PersistenceManager pm = pmf.getPersistenceManager();
   try {
     Query query = pm.newQuery(c, queryString);
     query.declareParameters(parameterDeclaration);
     List<T> list = (List<T>) query.executeWithArray(parameters);
     List<T> buffer = new ArrayList<T>();
     for (T t : list) {
       buffer.add(t);
     }
     query.closeAll();
     return buffer;
   } catch (Throwable e) {
     LOG.warning(e);
   } finally {
     pm.close();
   }
   return new ArrayList<T>();
 }