Heat 1 tablespoon butter in a pan over medium heat. Dice 1 onion and cook for about 4 minutes until translucent. Cut the smoked pork into cubes, add to the pan, and cook for about 6 minutes until browned. Pour in the milk and stir in the cheese until melted.
Spread the drained beans in a baking dish. Pour the pork mixture over the beans and mix well.
Slice the remaining 2 onions. Heat the same pan over medium heat with a splash of milk and cook the onion slices for about 4 minutes until translucent. Spread the cooked onions over the bean casserole.
Bake at 185°C (365°F) for 15-20 minutes. If using fresh beans, bake for 30-40 minutes instead.