-
Notifications
You must be signed in to change notification settings - Fork 14
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
Non-changing update of an entity value of type BigDecimal leads to: itemToUpdate.getChangedFields().size() >0 #704
Comments
Hi @itmstr01, what is your use case for this? Can't you do the check/conversion before the update? Best, |
First of all: Can you guarantee that the BigDecimal value within the entity always contains no decimal places if it contains an integer value? (and no extra zeros on fractional values) That would be the prerequisite for solving the problem on our side. We get the data via XML. The XML is merged into the entity for updating. The merge process is configurable via a mapping definition. To solve the problem on our side, I have to change the merge process. This is not an easy thing to do in our case. We cannot control the format inside the XML, so one can give 6E2 instead of 600. And that is not equal! |
I am looking into this and will let you know as soon as I have more information. |
Hi @itmstr01, our SDK is aligned with the OData standard about EDM.Decimal. The OData Documentation states under 11.4.2.1:
In the OData-ABNF it says under 7. Literal Data Values: Thus, in order to stay aligned with the OData standard, we do not treat different decimal values (that adhere to the above ABNF) as if they were other values, even if those other values mathematically are equivalent. This means, unfortunately, that we cannot change the behavior of the SDK as you suggested. Nevertheless, we don't change the decimal value internally in the SDK (in serialisation or else). So what the server sends out is propagated through the SDK without changing the format. This should make it possible for you to solve the issue on your side. Regarding implementation, one way might be to overwrite I hope this helps you! Best Regards, |
How can I overwrite methods in VdmObject without changing the generated Entities by hand? |
I didn't mean that you can/should change the generated entities themselves. What i ment was creating a subclass that extends the generated class. In that subclass you then can for example overwrite Let's assume you have the generated class
To use this new class, you would, however, probably need to manually transfer the fields from each instance of |
Describe the Bug
I read an Item-Object of a Bom. The value of componentQuantity is "1" as a BigDecimal.
I updated the value of componentQuantity with "1.0", wich should be mathematically the same!
But now the expression itemToUpdate.getChangedFields().size() >0 is true!
The reason is this behavior: new BigDecimal("1.0").equals(new BigDecimal("1")) == false
Sadly the VdmObject.getChangedFields() uses the equals-method for delta-detection.
With BigDecimals you have to use "compareTo() == 0" for equality-testing.
This behavior can lead to performance issues and huge network traffic.
Steps to Reproduce
See bug description
Expected Behavior
itemToUpdate.getChangedFields().size() == 0
Screenshots
No response
Used Versions
mvn --version
:SAP Cloud SDK version: 5.15.0
Spring Boot or CAP version: no
Dependency tree via `mvn dependency:tree`
Code Examples
Stack Trace
No response
Log File
Log file
...Affected Development Phase
Release
Impact
Impaired
Timeline
Needed end of Feb.
The text was updated successfully, but these errors were encountered: