Invalidate and regenerate in a transaction.