I don't personally know who wins in an x vs. y situation, but as phillie said, the whole point is that warfare can't be good for anyone and should be avoided. With that being said, the hammer can only do one thing, and that is defend the spot you've put it at. The anemone, on the other hand, will choose a spot it likes and stay there - so the solution is move the hammer as far away from the anemone's "spot" as possible, and let the 'nem do its thing. Once it gets comfortable, place the hammer a safe distance away.
As far as the stinging, I think most of these animals are resilient enough to recover, but they have to have optimal conditions, which would include as little stress as possible from a rival coral/invert.