Skip to content

Optimize calls to SimpleJpaRepository.save(…) if the entity is still attached [DATAJPA-931] #1285

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

Closed
spring-projects-issues opened this issue Jul 20, 2016 · 3 comments
Assignees
Labels
type: enhancement A general enhancement

Comments

@spring-projects-issues
Copy link

Oliver Drotbohm opened DATAJPA-931 and commented

As described in Vlad Mihalcea's blog, the call to merge for an entity still attached to a persistence context can lead to superflous code execution and event triggering in persistence providers.

We should guard the call to EntityManager.merge(…) with a check whether the given entity is currently attached


Reference URL: https://vladmihalcea.com/2016/07/19/jpa-persist-and-merge/

Issue Links:

  • DATAJPA-1261 Revert optimizations made for existing entities in implementation of CrudRepository.save(…)

Referenced from: pull request #237, and commits a2d3acf, 68fcf6e, 8265daf, 476baa4, f3b9131, c47ff56, 26f70bf

Backported to: 2.0.3 (Kay SR3)

@spring-projects-issues
Copy link
Author

Сергей Цыпанов commented

There's a pull request #249 reverting changes made in #237. Is there any explanation why those changes were reverted?

@spring-projects-issues
Copy link
Author

Oliver Drotbohm commented

See my comments on DATAJPA-1261 for further details

@spring-projects-issues
Copy link
Author

Сергей Цыпанов commented

Thanks for explanation!

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

No branches or pull requests

2 participants