Preheat the oven to 300 degrees F.
Place the cleaned beans into a medium saucepan. Add water to just cover and a generous pinch of salt. Bring the water to a boil over high heat then reduce to a simmer and let simmer until the beans are tender, about 10 minutes.
In a 12 to 14-inch saucepan, heat 2 tablespoons olive oil over a medium-high flame until hot but not smoking. Add the onion, celery and parsley and cook, stirring occasionally, until the onion and celery soften and turn a light golden brown, about 5 minutes. Add the lightly browned vegetables to the pot of beans. Bring the liquid back to a boil and then reduce to a simmer. Let simmer for 20 minutes more, until the beans have softened and cracked open, yielding a dry mixture.
In a small saucepan over low heat, heat the milk and add the flour, stirring with a wooden spoon until the flour dissolves completely into the milk and the liquid is homogenous, about 3 minutes. Remove from the heat.
Crack the eggs into a large mixing bowl and, using a whisk or fork, beat until homogenous. Add the bean mixture, the Parmigiano, and the milk mixture. Mix with a wooden spoon until well combined, about 3 minutes.
Lightly oil a 6-inch round baking pan. Make sure you use a pan that can fit comfortably in another pan working as a hot water bath. Pour the bean mixture into the pan and, using the back of a wooden spoon, level the top. Cover the top of the pan tightly in aluminum foil. Place the filled pan in the larger pan and fill the larger pan with hot water until it comes halfway up the sides of the filled pan.
Place in the oven and cook until the custard is cooked through the center but yields slightly when pressed, about 1 hour.
Recipe courtesy of Mario Batali