-
Notifications
You must be signed in to change notification settings - Fork 0
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
Replacing PUT with PATCH #39
base: main
Are you sure you want to change the base?
Conversation
@@ -21,7 +21,7 @@ public class CostOptionDTO { | |||
private LocalDate validTo; | |||
private String option; | |||
private String currency; | |||
private int amount; | |||
private Integer amount; |
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.
Why do we need Integer
? Integer
creates and Integer
object, which uses more memory. Why no use the primitive int
?
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.
int
is a value type so its default initialized to 0
instead of null
src/main/java/com/sarapis/orservice/dto/upsert/UpsertLocationDTO.java
Outdated
Show resolved
Hide resolved
@@ -90,23 +90,28 @@ public class Location { | |||
|
|||
@PreRemove |
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.
What is this @PreRemove
doing?
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.
It's setting the opposite side of the bidirectional relationship to null when the entity is delete. I think this is necessary since the relation is bidirectional.
@ZhangTerrence Added some comments! |
Replaced PUT with PATCH and so upsert dtos now support partial updates. In the case where a collection is being updated, all the existing relations in that collection are disassociated and then the only the ids given in the new collection are added back.