The solution is two states, where Israel returns to the 1947 UN borders, and allows the Palestinian Authority to have full control of Palestinian territory. Hamas exists as a powerful force because Israel consistently refuses to work towards a two-state solution in good faith.
The other solution is for the UN to de-militarize both the Palestinians and the Israelis, occupy all the land currently held by Israel, and force a power-sharing agreement and a new constitution so that Israel is no longer a Jewish state. Of course, the last time that Israel was occupied, you had a whole bunch of far-right Jewish terrorists that did things like assassinate diplomat’s families.