While the cooking time may seem extremely long, this is an old-fashioned Southern means of cooking vegetables. When cooked this way, the beans are served with their "pot liquor" and cornbread to sop it up.
Add the oil in a medium, heavy saucepan. Add the onion and saute until tender, about 3 minutes. Season with salt, pepper, and cayenne. Add the ham hocks, garlic, and beans. Add enough water to almost completely cover the beans. Bring to a boil, reduce the heat and simmer for 2 hours. Remove from the heat and serve with the cooking liquid.
The salt and pepper we used here were suitable for the ham hock we had. However, depending upon the cure of your ham hock, you may require more or less salt. That said, hold off on adding the salt until about halfway through the cooking process.