Hitting your dog is the worst thing you can do. It can actually make the peeing in the house
worse.
You need to make sure the dog is neutered, don't leave the dog loose in the house unsupervised.
get a crate and a book on crate training you dog and start from the beginning. If you have been hitting your dog you have a dog that is now fearful. You will need to be very patient and positive
with your dog.