For the baked beans, soak the beans in cold water overnight.
Preheat the oven to approx. 170 °C. Strain the beans, dice the onion not too finely.
Fry the bacon cubes in an ovenproof pot. Fry the onions until they have taken on some color. Add just under 1 1/2 l of water and the remaining ingredients (except the beans). Simmer for a few minutes. Season well with salt and pepper. Stir in the beans and bake, covered, in the oven for about 4-5 hours until the beans are tender. Stir from time to time.
If the liquid has not thickened by then, you may still want to simmer uncovered on the stovetop. Season the baked beans again and serve hot.