1. Cook the lentils in a large amount of water for about 10-15 minutes. Generously salt halfway through cooking. Drain and set aside.
2. In a pan, sauté the onion in oil. When it starts to brown, add the carrots and garlic. Season with salt and pepper and continue cooking for 5 minutes.
3. Pour the mixture into a large buttered and floured cake pan.
4. In a bowl, whisk the eggs with the grated Comté cheese and breadcrumbs.
5. Add the well-drained lentils, vegetables, and spices. Season to taste.
6. Sprinkle with roughly chopped hazelnuts and bake in a preheated oven at 350°F (175°C) for 45 minutes.
7. Serve warm or cold with a salad.