@Override
    public void deleteMedicine(MedicineDTO medicine) throws SQLException {
        Session session = null;
        try {
            session = HibernateUtil.getSessionFactory().openSession();
            session.beginTransaction();
            session.delete(medicine);
            session.getTransaction().commit();
        }
        catch (Exception e) {
            System.err.println("Error while deleting a medicine!");
        }
        finally {
            if (session != null && session.isOpen())
                session.close();
        }
    }