The great house of prayer reflected honor not only on Solomon and the people, but also on King David. The following incident proves it: When the Ark was about to be brought into the Holy of Holies, the door of the sacred chamber locked itself, and it was impossible to open it. Solomon prayed fervently to God, but his entreaties had no effect until he pronounced the words: "Remember the good deeds of David thy servant." The Holy of Holies then opened of itself, and the enemies of David had to admit that God had wholly forgiven his sin.
David's Ghost Helps Solomon Open the Temple Gates
Legends of the Jews 5:102