Ejemplo n.º 1
0
 public UsersDataSet getUser(long id) throws DBException {
   try {
     Session session = sessionFactory.openSession();
     UsersDao dao = new UsersDao(session);
     UsersDataSet dataSet = dao.get(id);
     session.close();
     return dataSet;
   } catch (HibernateException e) {
     throw new DBException(e);
   }
 }
Ejemplo n.º 2
0
 public UsersDataSet getUserByName(String name) throws DBException {
   try {
     Session session = sessionFactory.openSession();
     UsersDao dao = new UsersDao(session);
     long id = dao.getUserId(name);
     UsersDataSet dataSet = dao.get(id);
     if (id == -2) {
       return null;
     }
     session.close();
     return dataSet;
   } catch (HibernateException e) {
     throw new DBException(e);
   }
 }