Job is often seen as the epitome of the man who loses everything. The book of Job opens with Job living a full life by any standard. He has great wealth, a large family, and general ease. He is described as "blameless" and a man who "shuns evil." God loves Job's heart, but Satan is convinced that Job only loves God because God has blessed him. God believes Job will be faithful regardless of circumstance and allows Satan to take anything from Job that he wishes in order to test him. Job loses everything: his wealth, his animals, and every single child he has fathered. Still, he praises God. Job's friends turn against him, wondering what sin he has committed to earn such devastation. Job knows that he has committed no sin against God, but he is further isolated by friends who turn against him.
I wouldn't say Hamlet shares a great deal with this man of the Bible. He certainly isn't blameless, and we can't say that he "shuns evil," either. This comparison likely is attributed to the suffering of Hamlet and the idea that he loses (almost) everything. His father dies before the play opens. He learns that his uncle (and father's brother) has killed King Hamlet. He is betrayed by his old friends Rosencrantz and Guildenstern. His former love interest, Ophelia, becomes a pawn, spying on him for her father and Claudius. He learns that she dies, and her death is likely the result of suicide.
Hamlet manages to hold on to the friendship of Horatio throughout the play, and that's about it. He loses everything else dear to him, including his mother, and then his own life ends at the play's conclusion. Thus, this idea of incredible loss and suffering that is prominent in the book of Job could be extended to the losses Hamlet experiences.