On the day Solomon sought to bring the Aron, the Ark of the Covenant, into the newly finished Temple, the gates refused to open. Solomon stood before them and began to recite psalms. He recited one. The gates stayed shut. He recited another. Nothing moved. He recited twenty-four psalms in succession, ending with the great processional cry, "Lift up your heads, O ye gates, and be ye lifted up, ye everlasting doors" (Psalms 24:9). The gates did not lift.
Solomon was the wisest king Israel had ever produced. He was the builder of the Temple itself. He had commanded the labor of tens of thousands. He had the merit of his own office, his own wisdom, his own psalms. None of it was enough to open the doors of the house he had built.
Then Solomon changed his prayer. "O Lord God," he said, "turn not away the face of Thine anointed: remember the mercies of David Thy servant" (2 Chronicles 6:42). At the mention of David's name, the gates swung open.
The Talmud in tractate Moed Katan (9a) records that on that day, the enemies of David turned black in the face. Everyone watching understood what had just been announced from heaven. David's great sin with Bathsheba had been forgiven. The father who had not been allowed to build the Temple had nevertheless become the key that unlocked its doors. The son prospered by the merit of the father's repentance.