Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hypersistence Optimizer Issues: Critical: BidirectionalSynchronizationEvent #2263

Open
ecruz165 opened this issue May 1, 2023 · 2 comments · May be fixed by #2220
Open

Hypersistence Optimizer Issues: Critical: BidirectionalSynchronizationEvent #2263

ecruz165 opened this issue May 1, 2023 · 2 comments · May be fixed by #2220

Comments

@ecruz165
Copy link
Contributor

ecruz165 commented May 1, 2023

https://vladmihalcea.com/hypersistence-optimizer/docs/user-guide/#BidirectionalSynchronizationEvent

The Hypersistence Optimizer report suggests adding synchronization methods.

When mapping a bidirectional one-to-many or many-to-many association, you need to synchronize both sides of the association. Without synchronizing both sides, Hibernate cannot guarantee that the association state changes propagate to the database.

More, unsynchronized bidirectional associations can also lead to very subtle bugs that are hard to reproduce. For this reason, it’s best to have two utility methods (e.g., addEntity and removeEntity) on the mappedBy side of the one-to-many or many-to-many associations.

@chrisknoll
Copy link
Collaborator

My understanding is that Spring JPA will wrap Entity Bean manipulation into a 'session transaction' such that it will ensure these updates are ACID. Are you worried about different users manipulating the same entity at the same time? If so, I wouldn't put this at a high priority because Atlas is not a high-transaction system, you have a group of users working on their own assets where it's very rare that there would be any cross-talk between updates.

If you're talking about another context, could you elaborate on the specific use case in question?

@ecruz165
Copy link
Contributor Author

ecruz165 commented May 2, 2023

This recommendation is marked as critical. It's nice to have and removes critical warnings from the Hypersistent analyzer reults. I made the change already. Pull it in if you see the value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants