Not only did 2 Sam 7:14 mention that God would correct David's descendent with a rod and wounds when he sins, and not only can we determine from 2 Sam that it's about Solomon, but the parallel passage in Chronicles explicitly says it was Solomon:
1 Chr
28:5 From all the many sons the Lord has given me, he chose Solomon my son to rule on his behalf over Israel.
28:6 He said to me, ‘Solomon your son is the one who will build my temple and my courts, for I have chosen him to become my son and I will become his father.
There's no sense from the passage that it's about anyone other than Solomon. There is a prophecy made (2 Sam 7//1 Chr 17) and there is a specific fulfillment found (1 Kn 1-2, 5, 8 //1 Chr 28). We have a listing of the specific sins that David's son (Solomon) wound up committing and the consequences that followed (1 Kn 11), just as predicted.
It's not that I don't believe Jesus is the messiah, btw (before anyone throws out that accusation), or that Jesus wouldn't do some things like Solomon did (ie, build a temple, be wise, etc..). It's just that Solomon is explicitly called God's son, just as David was. The simple conclusion is that in the OT, being God's son was a royal function, was a royal title, and had to do with rank and position. In the OT, it didn't say anything about the ontological status of David, Solomon, the king, or Israel. Israel was God's firstborn son as Israel was the chosen people, the inheritor of creation, the one chosen by God to rule creation and be his representation on earth. The king had the same title as Israel due to the fact that he was the "embodiment" of Israel - he was the representative of Israel. He was supposed to represent his people to God and represent God to his people, though none of them ever exactly lived up to those functions.
Now I do think that in John, he uses the title "Son of God" in a unique way that goes well beyond what was said of David, Solomon, the king, or Israel. But that's in John, not Samuel.
It's a Psalm about the Davidic covenant, sure, but I don't think it's a prophecy in the sense that it's a prediction made and later the prediction comes true when Jesus comes around.
Like I said above, being the firstborn describes position and rank - "higher than the kings of the earth."
Sons? Did Jesus have sons? No, but David did. And they disobeyed the law.
Just as happened with the various bad kings of Israel and Judah.