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

Make sure AbstractEntity sets isNew flag in @PrePersist #269

Closed
odrotbohm opened this issue Jul 10, 2019 · 0 comments
Closed

Make sure AbstractEntity sets isNew flag in @PrePersist #269

odrotbohm opened this issue Jul 10, 2019 · 0 comments
Assignees
Milestone

Comments

@odrotbohm
Copy link
Member

AbstractEntity is setting the transient isNew flag in an @PostPersist method. The invocation of that method can be delayed until actual database interaction by the JPA provider which might result in an entity instance being returned as new from a call to CrudRepository.save(…).

We should move to tweaking the flag in @PrePersist.

@odrotbohm odrotbohm self-assigned this Jul 10, 2019
@odrotbohm odrotbohm added this to the 7.2 milestone Jul 10, 2019
odrotbohm added a commit that referenced this issue Jul 10, 2019
…ostPersist.

This is to make sure that the persistence provider actually flips the flag in CrudRepository.save(…) or EntityManager.persist(…) to be precise.

With the previous implementation the entity was returned from CrudRepository.save(…) as new which is wrong in itself but also caused test errors trying immediate subsequent deletions that run into an early return due to optimizations introduced for DATAJPA-1535.
odrotbohm added a commit that referenced this issue Jul 10, 2019
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

No branches or pull requests

1 participant