@Override
    public List<MedicineDTO> getAllMedicines() throws SQLException {
        Session session = null;
        List<MedicineDTO> medicines = new ArrayList<MedicineDTO>();
        try {
            session = HibernateUtil.getSessionFactory().openSession();
            medicines = session.createCriteria(MedicineDTO.class).list();
        }
        catch (Exception e) {
            System.err.println("Error while adding an illness!");
        }
        finally {
            if (session != null && session.isOpen())
                session.close();
        }
        return medicines;
    }