Open lucasoares opened 1 month ago
@cindy-peng : Does Datastore have an opinion on preferred behavior here?
Hopefully my comment is not just noise: Is Jackson used for (de-)serialisation of objects?
If so, is @JsonInclude(Include.NON_NULL)
an option?
Hopefully my comment is not just noise: Is Jackson used for (de-)serialisation of objects? If so, is
@JsonInclude(Include.NON_NULL)
an option?
Nope, it does not use jackson. I tried this.
I modified my code to use basic Entity and datastore template directly so when I fetch the object and save it, only existing properties are saved. But this is just a ugly workaround.
I'm migrating datastore operations from a GAE python application to a Spring Boot application but there is a compatibility issues between them when mapping entities that have repeated integer fields that are non required. Since datastore is a nosql database, these fields are simply omited by the native datastore library used on the python appengine. But with spring cloud datastore, these properties are saved as a
NULL
field inside datastore instead.Example:
Current python example
Currenty java example
When I save this class to the datastore, if
writers_ids
are non defined (None
in this case), the entity will be saved without the field.But when I have this same class mapped on spring boot and save it, the property will be saved as a NULL field:
In the previous picture, the second line was saved by the python code, and the first, by the java code.
When the python application tries to read this entity, it will throw an error
"initial generator _put_tasklet(context.py:372) raised BadValueError(Expected integer, got None)"
because the porperty exists but is None.How to omit null fields from being persisted in the datastore?