Mapping of large numbers fails when using MongoDB #192
Comments
cant reproduce it
Which version of gson and mongo you have in runtime? |
com.google.code.gson:gson:2.3.1 |
still, i cant reproduce it, |
I tried with gson 2.2.4 but the test still fails. We use MongoDB 3.0.5 on windows.
|
I need to reproduce the error on my laptop. I've pushed new test ("should support long number as Entity Id") for this case to master |
OK. I'll create a fork and push it there. |
right, we need to proof that it isn't local enviroment issue |
I have a nasty firewall here at work, so I cannot download the dependencies specified in the build file. I have to try at home instead. |
any progress with reproducing this issue? |
closing due to lack of activity, cant reproduce it |
Observing the same issue with mongoDB 3.0.6 running on Debian. Using mongo drivers 3.0.1 to 3.1.0 and latest javers. |
I need a failing test with reproduction of this issue, could you provide it? |
I am also seeing this issue with gson:2.3.1 and mongo-java-driver:3.0.1. I took the liberty of adding @linderl 's test case: jlsalmon@88fa048 It fails for me too. |
Guys, if you can reproduce it, think about contributing a Pull Request with a fix. |
I discovered that mongo persists different json documents:
{"entity":"org.javers.repository.mongo.Issue123$MyEntity","cdoId":{"$numberLong":"1000000000000"}}
{"entity":"org.javers.repository.mongo.Issue123$MyEntity","cdoId":1000000000} and when Gson tries to deserialize the first object it expects number but there is: {"$numberLong":"1000000000000"} and that's why it finished with java.lang.IllegalStateException: Expected NUMBER but was BEGIN_OBJECT I will try to go deeper and solve this problem :) |
@pawelszymczyk nice, we are waiting for PR |
@bartoszwalacik and here it is #266 :) |
Bug is fixed in version 1.4.0-RC2 http://search.maven.org/#artifactdetails|org.javers|javers-core|1.4.0-RC2|jar |
I have a similiar problem with the class "java.util.UUID". The property mostSigBits is like "{"$numberLong":"453454......"}" but Gson expects a number. |
think it would be better to implement JsonConverter for UUID and to store them as @arnzel could you create a separate issue for that? |
Support for java util types: UUID, File, Currency, ...
fix released in JaVers 1.4.10 |
When using large numbers as id's for entity objects you get this exception:
Here is the unit test that triggers the bugg:
The text was updated successfully, but these errors were encountered: