While it is true that Wright was Obama's pastor for 20 years and Hagee/Parsley were not McCain's pastors for 20 years, I think this actually works in the opposite direction - against McCain.
Obama can claim that his relationship to Wright is personal and spiritual, based on routinely attending his church, listening to sermons that are frequently religious in character (not all of Wright's sermons are as explicitly political), but that as he has come to realize that Wright is being deliberately divisive and offensive to some people he has disassociated himself. Obama and Wright (not to mention Wright's church and the entire community) had a relationship long before Wright uttered any of the controversial comments, and this may be the reason why he stuck it out even if he disagreed with some of the pastor's views.
McCain, on the other hand, has no such excuse. He actively sought out the endorsement and support of two pastors - Parsely and Hagee - who made horrible, offensive comments against gays and catholics long before he sought out their endorsement. In other words, his relationship to them is purely for political gain.
To summarize, Obama's relationship to a controversial pastor was based on him attending church and being part of a community and he knew the pastor long before the controversial comments. McCain's relationship to his pastor's is purely one of choice and it is purely political (to pander to the religious right) and is taking place AFTER the controversial comments.
McCain has not distanced himself from those two pastors. Furthermore, at one point, he even called them agents of intolerance, which just further reaffirms that his embrace of these bigots is pandering of the worst kind.