Preheat the oven to 220 C, 200 Fan Gas 7 and get all your ingredients ready. Put a wide, shallow ovenproof casserole on a medium heat and add a good glug of olive oil. Fry the onions until soft and sweet.
Meanwhile cut the squash into large dice, discarding the seeds. You do not need to peel unless the skin is very tough. Add this to the softened onion with the leaves from the rosemary sprigs. Cook for about 10 minutes until the squash has coloured a little at the edges and is starting to soften.
Remove from the heat and add the drained cannellini beans, then season with salt and pepper and squeeze over the juice of the lemon.
Pour over the stock, then tear the bread into about 1 inch chunks over the top. Grate over the cheese. Bake for 35 to 45 minutes until the cheese has melted and the stock is bubbling around the edges.