They were both righteous before God, walking blamelessly in all the commandments and ordinances of the Lord.
And, of course, throughout the Old Testament prophesies, there was that promise that the Messiah would sit upon the throne of David, to order it, and to establish it in righteousness and in judgment, from henceforth, even forever.