one way maybe that would work is if you said "look, i'm really not comfortable with you hugging me so please don't." you shouldn't have to enforce it, like a rhyme that one of my friends likes to say:
"my body is mine from my head down to my toes
please leave me alone when i tell you NO!"
((((((silver))))))) i've known people who do this too. i generally try to shrug out of that uncomfortable embrace and step away back to a personal distance i'm more comfortable with. if that doesn't work, then i tell them what i said above. if -that- doesn't work then i avoid their presence altogether. for someone you can't avoid... perhaps if you can anticipate the gesture and move out of reach before they can complete it then it will work.
i hope that helps.
-shadow