These verses in Exodus 34:6-7, are often mis-understood: "The LORD God, merciful and gracious, longsuffering, and abundant in goodness and truth, Keeping mercy for thousands, forgiving iniquity and transgression and sin, and that will by no means clear the guilty; visiting the iniquity of the fathers upon the children, and upon the children’s children, unto the third and to the fourth generation."
Saint Cyril of Alexandria explains to us this apparent contradiction in this beautiful way:
The Jewish populace did not correctly understand this. thinking that God was so harsh, inexorable. and persistent in his wrath as to impose the crimes of parents on their children's children. They said as much. for instance, in claiming, “The parents ate sour grapes. and the children's teeth were set on edge.” Consequently, God said to the prophet Ezekiel, "Son of man. what do you mean by repeating this proverb in Israel, The parents ate sour grapes. and the children's teeth were set on edge? As I live, says the Lord. let this proverb no more be recited in Israel, because all lives are mine; the life of the parent as well as the life of the child are mine. Someone who is righteous shall not die; the child will not take on his parent's sin. nor a parent take on his child's sin.” (Ezek 18:1-4,20) After all, how could the Lord of all still be long-suffering, rich in mercy. and truthful if he did not forgive sins and clear the guilty. but extended his anger to the third and fourth generation? What is the reasoning. then? While He is patient, as I said, and incomparably good, and does not immediately inflict punishment on sinners, He postpones it even to the second generation in the hope that perhaps some repentance may intervene and terminate the wrath. If this does not happen, however, and the third generation after the first and the fourth do likewise, or they are caught up in still worse evils, and are found to imitate their forbears’ impiety, then and only then does he impose punishment after having already shown the family sufficient patience for past sins. This is the meaning of inflicting sins of parents on the third and fourth generations.
From the book: ST. CYRIL OF ALEXANDRIA: COMMENTARY ON THE TWELVE PROPHETS, volume 2, pp 16-17, available from: amazon.com or amazon.ca