David was a man after God's own heart.
NIV 1 Samuel 13:14
But now your kingdom will not endure; the LORD has sought out a man after his own heart and appointed him ruler of his people, because you have not kept the LORD's command."
Jehoshaphat sought the LORD with all his heart.
NIV 2 Chronicles 22:9
He then went in search of Ahaziah, and his men captured him while he was hiding in Samaria. He was brought to Jehu and put to death. They buried him, for they said, "He was a son of Jehoshaphat, who sought the LORD with all his heart." So there was no one in the house of Ahaziah powerful enough to retain the kingdom.
How was Jehoshaphat's heart compared to David's heart?