How long do inlay and onlay restorations usually last, and what factors can shorten their lifespan?

How long can I expect inlay and onlay restorations to last, and what habits or conditions might cause them to fail sooner?