-
-
Notifications
You must be signed in to change notification settings - Fork 367
Skip persisting empty commits (with 0 snapshots) in SQL repository #505
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
Comments
Hi, please follow the https://github.com/javers/javers/blob/master/CONTRIBUTING.md Bug Reports have to contain:
|
As you can see in the following example, the second commit creates an entry in jv_commit and no entries in jv_snapshots. When we auto-audit repositories this leads to a lot of entries in jv_commit that are not referenced from other tables because usually we don't check if the entity has been updated before calling repository.save(entity). Javers javers = JaversBuilder.javers().build();
Person robert = new Person("bob", "Robert Martin");
javers.commit("user", robert);
//creates an entry in jv_commit even though nothing has changed on the object
javers.commit("user", robert); The expected behavior would be that commits are persisted only when the commit has snapshots. Sorry, I couldn't come up with a runnable test case. |
You mean this is not OK that empty commits are persisted? |
Yes, exactly. |
Feel free to create a pull request. This issue is easy to implement so perfect for contribution. |
I can create a pull request. |
PR should be created from your fork. Looks like the problem could be solved in javerscore, before calling JaversRepository |
PR merged to master |
It's done, thanks! |
released in 3.0.4 |
Hi,
I am using JaVers 3.0.0 with Spring Boot. I noticed that new entries are stored in jv_commit even when there is no change in the object. Since these commits are not referenced from other tables, they are kind of useless.
The text was updated successfully, but these errors were encountered: