"He shall build an house for my name, and I will stablish the throne of his kingdom for ever. I will be his father, and he shall be my son. If he commit iniquity, I will chasten him with the rod of men, and with the stripes of the children of men." (2 Samuel 7:13-14)
These verses comprise the heart of the great "Davidic Covenant" made by God with David and his "seed." As with many Old Testament prophecies, it had both an immediate and ultimate fulfillment. Initially, it applied to Solomon who did, indeed, "build an house for my name." Its complete fulfillment, however, had to await the distant coming (a thousand years in the future for His first coming) of David's greater Son, the Messiah. It was only of Him that God could promise uniquely that He would also be the Son of the heavenly Father (Hebrews 1:5). To His mother, Mary, the angel Gabriel confirmed the Davidic promise: "He shall be great, and shall be called the Son of the Highest: and the Lord God shall give unto him the throne of His father David: And he shall reign over the house of Jacob for ever; and of his kingdom there shall be no end" (Luke 1:32-33).
But before his eternal throne could be established, his iniquities must be judged. As far as Solomon was concerned his iniquities ultimately cut his own seed off from the throne. "The seed of David according to the flesh" (Romans 1:3) came through Nathan, not Solomon (Luke 3:23-31).
Although Jesus Christ "knew no sin" (2 Corinthians 5:21), "he was bruised for our iniquities," because "the LORD hath laid on him the iniquity of us all." He deserved no chastening; nevertheless, "the chastisement of our peace was upon him" (Isaiah 53:5-6).