-
Notifications
You must be signed in to change notification settings - Fork 9
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
Feat/729 refactor settings releases #733
Conversation
AMW_angular/io/src/app/shared/date-picker/date-picker.component.html
Outdated
Show resolved
Hide resolved
...ness/src/main/java/ch/puzzle/itc/mobiliar/business/releasing/boundary/ResourceEntityDto.java
Outdated
Show resolved
Hide resolved
.../src/main/java/ch/puzzle/itc/mobiliar/business/releasing/boundary/ResourceTypeEntityDto.java
Outdated
Show resolved
Hide resolved
AMW_rest/src/main/java/ch/mobi/itc/mobiliar/rest/releases/ReleasesRest.java
Outdated
Show resolved
Hide resolved
AMW_rest/src/main/java/ch/mobi/itc/mobiliar/rest/releases/ReleasesRest.java
Show resolved
Hide resolved
AMW_rest/src/main/java/ch/mobi/itc/mobiliar/rest/releases/ReleasesRest.java
Show resolved
Hide resolved
AMW_rest/src/main/java/ch/mobi/itc/mobiliar/rest/releases/ReleasesRest.java
Show resolved
Hide resolved
AMW_rest/src/main/java/ch/mobi/itc/mobiliar/rest/releases/ReleasesRest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall - good work!
I have some minor comments and we have to discuss if it makes sense to further split up some of the angular components...
084f9ce
to
b5b71bd
Compare
Editing a release that has a deployment gives a Internal Server Error (500):
How to reproduce with dev container:
=> Server error |
Maybe this could be turned into an integration test? 😁 |
Reproducing the issue is much simpler:
Hibernate tracks concurrent modifacations of entities with a version property that is annotated with For the Release entity, this property is also annotated with Removing the |
AFAIK we never exposed the Version in the rest entities. I believe this was handled by merging the entity back into the jpa context before persisting it. |
I've just checked all endpoints and this is true: the version property was never exposed. But, there are currently only a few endpoints that update an existing entity. I've checked them all. All of them accept a bunch of query parameters and/ or some form of a DTO. The backend then loads the entity, sets the new properties and then writes it back to the database. That's why there was never a problem with optimistic locking, and there are checks in place to prevent that different users to overwrite each others changes. But in case of the new endpoint to edit releases, it's indeed the version property that prevents the entity being merged back into to the jpa context - that is when hibernate compares the property and throws the StaleObjectStateExcpetion in this case. I strongly recommend to pass the version property to the frontend (and then send it back with the PUT request) in order to prevent users overwriting each others changes. Even if there are only a few users that use the application and they are infrequently creating or updating releases. |
I quickly tested the current jsf implementation without exposing the version property. If two users edit the same entity the update fails for one user throwing |
This is probably because JSF is stateful and keeps the entity with the version in the session? |
I added the version in the frontend and wrapped the exception in a ConcurrentModificationException |
Tested and works as expected, you can merge when ready |
5159ef3
to
b5df057
Compare
Fixes #729