I know my cats and dogs do this. I'm not too sure with hamsters but i know that when i stay at my friend's house, my hammie does get annoyed. Whenever i get back he is unsure around me, but i just persist with treats and attention and he remembers how at ease he can be. I think they just need time to familiarise themselves again
hopefully be buddies in no time! Good luck