David may be Israel's favourite king, but the reality of his life is rather a mixed bag. In fact, it's rather refreshing that the all too common human temptation to idealise heroes is frequently resisted in the books of Samuel. (On the other hand, when the story of Israel's kings is retold in Chronicles, this story is notably absent.)
David is clearly not perfect. He was a person of mixed motives, great faith, courage, love, greed, hungry for power, who killed those in opposition to his desires, he was sometimes cruel and had fits of anger. The key difference between David and most of us is that in his position of power, his choices (for good or for bad) are heightened and the outcomes greater. For example, his choice to cover up his liaison with Bathsheba results not only in the death of Uriah, but also probably of those around Uriah in the battle.
To read this only as a story about sexual temptation and immorality however would be to miss many salient points. This is not primarily a story about sex. The description of the liaison between David and Bathsheba is brief and to the point. David saw, he wanted and he took. We hear nothing of Bathsheba's viewpoint but considering the power differential this is not surprising.
At the time of this story, David has already had children to 6 different women. It seems that many of these could be interpreted as political acts, as the women involved often allied him to surrounding rulers or people of influence. Whilst it might be unfair for us to judge David by today's standards, it would be remiss to let this story pass and not absolutely refute the objectification of women by men for their own purposes. An honest reflection must acknowledge that the Bible records numerous examples of women seen as the 'spoils' of war.
The story of Bathsheba and Uriah reminds us that an atmosphere of legitimated violence, reflective of military cultures and the mindset of battle, does not limit the violence to the enemy, but ultimately swallows up all who are placed in the way of power.
However, there is some good news here and it is not merely about repentance (though sometimes this is necessary and David illustrates this later). The good news is that there are other paths; there are other models. In this story, it is Uriah who demonstrates the possibility of living differently. His humility, obedience and genuine compassion for his fellow soldiers stands in sharp contrast to David's abuse of power for his own purpose.