[BUG] Etag Value return null if etag attribute is annotated with @Version
and @JsonProperty("_etag")
in container class. || Spring Boot || ReactiveCosmosRepository
#40038
Labels
Azure.Spring - Cosmos
azure-spring
All azure-spring related issues
azure-spring-cosmos
Spring cosmos related issues.
Client
This issue points to a problem in the data-plane of the library.
customer-reported
Issues that are reported by GitHub users external to the Azure organization.
needs-team-attention
This issue needs attention from Azure service team or SDK team
question
The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Describe the bug
Etag Value return null if etag attribute is annotated with
@Version
and@JsonProperty("_etag")
in container class. || Spring Boot || ReactiveCosmosRepositoryException or Stack Trace
No Exception , But Etag becomes null. which create problem (412 precondition exception) in further update operation , as etag is null.
To Reproduce
@Container
].etag
, and annotate this with@Version @JsonProperty("_etag")
,@Version
is used to enable concurrency . [If invalid etag is passed while updating it should throw an exception, i.e. pre condition exception]ReactiveCosmosRepository<Person, String>
orCosmosRepository<Person, String>
.repository.save(person)
, record will be saved in database, but the returned saved person object will haveetag
as null.@Version
annotation and keep@JsonProperty("_etag")
, then I get the correct etag , but I have to compromise concurrency, which is not permissible in our system.@JsonProperty("_etag")
annotation and keep@Version
, then concurreny control works fine, and also recieve correct etag. But the problem here is , we use stored procedure to update the record , to achieve optimistic transaction, so in the database, in the document a new attribute gets created with nameetag
along with_etag
.etag
holds the last etag value, where as_etag
has the latest value.Code Snippet
Person.Java
PersonRepository.java
PersonService.java
PersonController.java
updatePerson.js -> Cosmos DB Stored Proce
PersonUpdator.java
pom.xml
Expected behavior
Two Things :
@JsonProperty("_etag")
on etag attribute should not make etag as null.@Version
, then updating a record via stored proc should not create anetag
attribute in the document .Screenshots
Setup (please complete the following information):
Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report
The text was updated successfully, but these errors were encountered: