Mary was James II's heir apparent when William married Mary in 1677, but the widowed James had a son by his second wife in 1688, and that infant son was James II's heir at the time of the Glorious Revolution. The arrival of a Catholic heir was trigger to the revolt against James. Later, after James II died in exile in 1701, the younger James came to be known as the Old Pretender (Jacobites regarding him as James VIII and III).
The Glorious Revolution was a successful coup d'etat staged by Whig oligarchs opposed to James II's Catholicism and his despotic aspirations, obtaining William's political leadership and military abilities in return for assistance in his European ventures. The Bill of Rights 1689 cemented the effects of the seventeenth century power struggles, and established the Constitution which, following the Reform Acts of the nineteenth and twentieth centuries, led to democracy. Thus, taking the long term view James, by his political blundering, was unwittingly a factor in the development of political stability in what became the UK.
As for hating the Stuarts, I rarely hate or experience any other strong emotions about anyone in the past. Expressing moral disapproval of what people long dead did or failed to do (for example, everyone except a few far right nutters detests what Hitler did) is not, perhaps, the same as hating them as people. Even the very flawed Charles I displayed some admirable qualities: He was physically courageous, and he showed dignity and composure at his trial. The only Seventeenth Century Kings of England and Scotland who appear from biographical details to have been likeable men were Charles II (also very flawed) and William III, who hoped for greater religious tolerance but was stymied by Sectarianism. Each of Charles and William was adept at politics, something which James I, Charles I, and James II couldn't manage. Anne, the last Stuart, is perhaps a bit underrated as a Monarch.