Heat the sunflower oil in a saucepan. Add the julienned onions into a bowl and sprinkle cornstarch on them. Cover them with starch and then add them to the pan and fry them over medium-high heat, for 7-10 minutes. Stir occasionally with a wooden spoon. They're ready when they're golden. Make sure you stir constantly so you won't burn them. You don't want to turn them black.
When ready, turn off the heat and sprinkle them with salt.
Meanwhile, put the lentils in a saucepan, cover them with water, and boil them for 20 minutes, until they're soft but not mushy.
Move the caramelized onions to a bowl and rinse the saucepan. Heat the saucepan and add the spices. Toast them over medium heat for 1 minute, then add the rice, olive oil, sugar, salt, and pepper. Stir well. Add the cooked lentils and 400ml of water. Let them simmer on low heat for 15 minutes.
Remove from the heat and cover the pan with a lid. Let it rest for 10 minutes. Serve this with the caramelized onion on top.