When Jehu confronts Jehoshaphat, he rebukes him not for his personal attitude toward personal friends and personal enemies, but for his conduct as king: the covenant king does not have the right to make alliances with those on whom the Lord himself has pronounced judgment.
In the context, then, David seeks to align himself with God’s perspective. He chooses to hate those whom God hates. He does not hate them because they are his enemies, but they are declared to be his enemies because he hates them, in imitation of God. And even in this he is careful not so much to seek vengeance himself as to ask God to slay the wicked (139:19).
D.A. Carson, Love in hard places, 42