There is no guaranteed way to prevent getting a hernia or to prevent recurrence of a hernia.