God told David it would be Solomon that would reign in peace; and it would be Solomon that would build the Temple, a House of God.
When Solomon began his reign at the age of twenty, he said to God that he needed discernment to distinguish right from wrong in governing God’s people, the Israelites. Solomon selectively applied the wisdom when convenient and at other times, satisfied his own interests when he wanted. Notably, he disobeyed God when he married foreign women and worse he turned away from God and pursued the gods of his foreign wives. God revealed what the consequences of these actions would be.
Near the end of his life Solomon stated, in Ecclesiastes, “Fear God and keep his commandments, for this is the duty of all mankind. For God will bring every deed into judgement, including every hidden thing, whether it is good or evil.” Did Solomon repent for his sins? Only God knows. [Reflection based on the Bible Reference – 1 Chronicles 22:9; 1 Kings 11:42-43a]