Let's set up the problem clearly:(source)
1. Elijah announced a dynastic judgment on Ahab’s line and household. God told Jehu to execute this judgment, which he did. Jehu is commended by YHWH for executing the house of Ahab in 2 Kings 10.30:
The LORD said to Jehu, "Because you have done well in accomplishing what is right in my eyes and have done to the house of Ahab all I had in mind to do, your descendants will sit on the throne of Israel to the fourth generation."
2. But then, a century later, in Hosea 1.4, Jehu is punished for the massacre!
Then the LORD said to Hosea, "Call him Jezreel, because I will soon punish the house of Jehu for the massacre at Jezreel, and I will put an end to the kingdom of Israel. (NIV)
The allegation is that God’s express commendation (earlier) is incompatible with/contradicts God’s (later) ‘negative judgment’ on Jehu for the same events, as expressed in Hosea 1.4.
The source I've linked above provides some possible solutions, but I think the easiest explanation is found by looking at a verse that the problem's statement overlooks.
In addition to killing the house of Ahab in Jezreel, Jehu also killed a significant part of the royal family of Judah (by God's providential decree, but not by God's command to Jehu):
2 Chronicles 22:7-9
And the destruction of Ahaziah was of God by coming to Joram: for when he was come, he went out with Jehoram against Jehu the son of Nimshi, whom the LORD had anointed to cut off the house of Ahab. And it came to pass, that, when Jehu was executing judgment upon the house of Ahab, and found the princes of Judah, and the sons of the brethren of Ahaziah, that ministered to Ahaziah, he slew them. And he sought Ahaziah: and they caught him, (for he was hid in Samaria,) and brought him to Jehu: and when they had slain him, they buried him: Because, said they, he is the son of Jehoshaphat, who sought the LORD with all his heart. So the house of Ahaziah had no power to keep still the kingdom.
2 Kings 10:12-14
And he arose and departed, and came to Samaria. And as he was at the shearing house in the way, Jehu met with the brethren of Ahaziah king of Judah, and said, Who are ye? And they answered, We are the brethren of Ahaziah; and we go down to salute the children of the king and the children of the queen. And he said, Take them alive. And they took them alive, and slew them at the pit of the shearing house, even two and forty men; neither left he any of them.
This murder God did not permit to go unpunished, but brought judgment on Jehu's line with a Jezreel of their own. Jehu was right to kill Ahab and his family, but not the family of David.
Thus, God commended and blessed Jehu:
2 Kings 10:30 And the LORD said unto Jehu, Because thou hast done well in executing that which is right in mine eyes, and hast done unto the house of Ahab according to all that was in mine heart, thy children of the fourth generation shall sit on the throne of Israel.
My friend Fred Butler will be happy to notice that "fourth generation" here was taken fairly literally:
2 Kings 15:12 This was the word of the LORD which he spake unto Jehu, saying, Thy sons shall sit on the throne of Israel unto the fourth generation. And so it came to pass.
1) 2 Kings 10:35 And Jehu slept with his fathers: and they buried him in Samaria. And Jehoahaz his son reigned in his stead.
2) 2 Kings 13:9 And Jehoahaz slept with his fathers; and they buried him in Samaria: and Joash [aka Jehoash] his son reigned in his stead.
3) 2 Kings 14:16 And Jehoash slept with his fathers, and was buried in Samaria with the kings of Israel; and Jeroboam his son reigned in his stead.
4) 1 Kings 14:20 And the days which Jeroboam reigned were two and twenty years: and he slept with his fathers, and Nadab his son reigned in his stead.
Leading finally to the destruction of the entire family of Jeroboam:
1 Kings 15:25-30
And Nadab the son of Jeroboam began to reign over Israel in the second year of Asa king of Judah, and reigned over Israel two years. And he did evil in the sight of the LORD, and walked in the way of his father, and in his sin wherewith he made Israel to sin. And Baasha the son of Ahijah, of the house of Issachar, conspired against him; and Baasha smote him at Gibbethon, which belonged to the Philistines; for Nadab and all Israel laid siege to Gibbethon. Even in the third year of Asa king of Judah did Baasha slay him, and reigned in his stead. And it came to pass, when he reigned, that he smote all the house of Jeroboam; he left not to Jeroboam any that breathed, until he had destroyed him, according unto the saying of the LORD, which he spake by his servant Ahijah the Shilonite: because of the sins of Jeroboam which he sinned, and which he made Israel sin, by his provocation wherewith he provoked the LORD God of Israel to anger.
One final note. Passages like these highlight two things. First, God is punishing the sins of Jehu upon Nadab. Second, God is also punishing the sins of Jeroboam upon Nadab. But, note that Jehu himself is not some innocent God-fearing man who is getting punished for nothing. He walked in the way of his father and did evil in the sight of the LORD. Had he repented, God would have spared him, for God is rich in mercy. So do not use the sins of your fathers as an excuse for your lack of repentance. Don't follow your fathers' evil ways, but follow the paths of righteousness that it may be well with you.