@Override
    public UserDTO getUserById(Long id) throws SQLException {
        Session session = null;
        UserDTO user = null;
        try {
            session = HibernateUtil.getSessionFactory().openSession();
            //user = (UserDTO) session.load(UserDTO.class, id);
            user = (UserDTO) session.get(UserDTO.class, true);
        } catch (Exception e) {
            System.err.println("Error while getting user!");
        } finally {
            if (session != null && session.isOpen()) {
                session.close();
            }
        }
        return user;
    }