What do we gain here?
First, we can tell from the life of Solomon that his deeds were not exemplary. Solomon made poor decisions in his multiple marriages and adulterous behavior. (Yes, adulterous behavior: he took concubines alongside his wives. Historically, concubines were taken to satisfy sexual drives without having to accord them the rights of wives. That falls under adultery.) He knew, first hand, what the side effects of poor decisions about sex were.
He then proceeds to tell his sons not to do what he did. Solomon says to listen to his words, and not his deeds. You know what we would do with him?
Call him a hypocrite and ignore him on the matter. Or point out that he’s just bitter, and how we would know how to avoid the pitfalls he fell into.
Is that the right response?
Is the man who fell into a volcano not the person to warn others about volcano-safety?
Solomon has learned, the hard way, about the dangers of spreading his heart around. He has learned the hard way that sex is more than a biological function.
The lesson here is two-fold:
First, the obvious lesson from the life of Solomon: restrain your desires and keep your passions directed. We are more than our sex drive, or at least we ought to be.
Second, the next lesson about how we take advice: sometimes, we need to listen to the people who have done poorly, because they know. The recovering addict, the thrice-divorced, all of these may have valuable wisdom for us going forward.
Third, the lesson for our teaching: did you slip and fail? I can recount my failures as a youth and young adult, but the Internet’s not big enough for me to write them all. Do I eschew correcting my children for the same crimes I committed? Nonsense. I still carry the scars. It would be negligent if I let my children go unwarned into the same fires.