Circular Reference:
News holds a Set<NewsReactions>, and each NewsReactions holds a reference back to News.
Set), it triggers a recursive call: News → NewsReactions → News → and so on, leading to infinite recursion and eventually a StackOverflowError.Override equals() and hashCode() Carefully:
equals() and hashCode(). Use only immutable and unique fields (like the ID).Fix in News and NewsReactions:
equals() and hashCode() using only the id field