You asked about electric fences
Please keep in mind they are TOTALLY DIFFERENT from an invisible fence
Debra mentioned an electric fence.
I have had these attached to my fence for over 15 years and the ONLY time there was an issue was when my crazy 1/2 AFs unplugged it and took off out the yard.
I run it along the bottom of the fence all the way around, and then back along the top of the fence.
The dogs learn quick to stay away from the fencing… and also do not dig in the yard [one dig near the fence cures them of that].
Now, an invisible fence… a waste of your money.
If you want to buy one, just get out some matches and burn your money.
You will get more pleasure out of that....
invisible fences do nothing for a bright dog, and allow any animal in the yard to attack/kill your dog.
Hope things are getting better with your pup!