when i was a kid my parents bought a middle aged sow that had lived with people closely. what a mistake, she would get out of her pen & seek us out. if we weren't there she would push doors open & in the first week or so mum was woken one night to crashing in the kitchen, this pig had got inside, opened the fridge & was trying to eat what ever it could.
she was very good when she had piglets, would let us handle them & my sister would sit with them & she was only about 3 at the time.
i am sure most training of animals involves a relationship with good behaviour & rewards, namely food so make sure you feed it away from your house