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