Rinse the dried beans thoroughly and remove any damaged beans or debris.
Place the beans in a large pot, cover with water, and bring to a boil. Drain, refill with fresh water, and continue cooking until the beans are tender but still hold their shape, about 1½ to 2 hours. Drain well.
Preheat the oven to 375°F (190°C).
Heat about half of the vegetable oil in a large skillet over medium heat. Add the sliced onions and cook slowly until soft, translucent, and lightly golden, about 20–25 minutes.
Stir in the garlic, sweet paprika, salt, and black pepper. Cook for 1 minute until fragrant.
Lightly oil a deep baking dish.
Spread a layer of cooked beans over the bottom of the dish, followed by a layer of the onion mixture.
Continue layering the beans and onions, drizzling a little oil between each layer.
Finish with a final layer of beans. Place the bay leaves and whole garlic cloves on top, then drizzle the remaining oil over everything.
Bake for 30–40 minutes, or until the top is lightly golden and bubbling.
Let the Prebranac rest for 10–15 minutes before serving.