vladmihalcea / high-performance-java-persistence

The High-Performance Java Persistence book and video course code examples
Apache License 2.0
1.31k stars 489 forks source link

question #46

Closed bojanv55 closed 5 years ago

bojanv55 commented 5 years ago

am I missing something here, or you don't need this check if (postTag.getPost().equals(this) ?

I guess you cannot add PostTag that has not this as inner Post, since only way yo do it should be addTag?

vladmihalcea commented 5 years ago

The check will cover the case when the both sides of the association were not properly synchronized. That's most likely why I had added that check.