Hi guys, I ran into strange issue with spring-data-rest. I have two columns being updated by @CreatedDate and @LastModifiedDate annotations. When I submit update PUT request without createdAt property specified in the body, it gets nullified in DB. Is this the expected behavior?
I have the following entity structure
Generally speaking, yes. PUT requires the resource identified by the URI the request is sent to to be replaced with what the client sends. So unless you take dedicated action on the server side to tweak those semantics. Spring Data REST already does so for properties that are better reflected through dedicated means HTTP exposes for their technical purpose: database identifiers are removed from the representation as HTTP defines URIs to be the primary means for identification. We also remove the last modified property from the representation as there's a standard header for that.
I just tried to use @ReadOnlyProperty on a class structured like yours and it looks like the component handling the application of JSON payloads to domain objects but it seems it currently doesn't have any effect. I guess that should be fixed here
Nestor Fedyk opened DATAREST-873 and commented
Hi guys, I ran into strange issue with spring-data-rest. I have two columns being updated by
@CreatedDate
and@LastModifiedDate
annotations. When I submit update PUT request without createdAt property specified in the body, it gets nullified in DB. Is this the expected behavior?I have the following entity structure
Affects: 2.4.4 (Gosling SR4), 2.5.2 (Hopper SR2), 2.6 M1 (Ingalls)
Backported to: 2.5.3 (Hopper SR3), 2.4.5 (Gosling SR5)
The text was updated successfully, but these errors were encountered: