Honestly, if a company can keep interesting work coming, and compensate me fairly (e.g., inflation-competitive raises, come on, that isn't so hard now is it?), I don't have any trouble sticking around forever.
Unfortunately it seems like the standard MO in this industry is to dangle a tasty carrot of an offer for jumping from your current ship, and then the gravy train stops, your raises can't cover cost of living increases, and your only way to advance is to jump ship again.
If your employees feel valued, feel like they're treated fairly, only a small portion will quit (the ones who just have to get up and do something else, and that's fine). If you have a persistent, significant problem with "hoppers" that speaks more about you as an employer than about your employees.