Open nickstolwijk opened 6 years ago
lazy init bitmap is declared as private transient volatile long lazyInitBitmap;
.
The problem is definitely in mongo serializer you use, many mongo mappers don't use Jackson or whatever JSON binding, but instead doing custom reflection to get values from private fields and/or getters. You can open a bug report to the mongo library to skip transient
fields, which should be a good idea even if unrelated to Java binary serialization. The other way is to use new experimental Annotation Injection functionality to apply arbitrary annotations to generated code (i.e. synthetic fields for lazy bitmap in this case), in this case it would be the way to add something like @JsonIgnore
or whatever annotation mongo mapper is using to skip fields.
Also Immutables provide mongo repository mapping functionality: http://immutables.github.io/mongo.html
I have a simple interface annotated with Immutable annotations. When I serialize this to JSON, I see the field lazyInitBitmap and the value of the lazy property in my Mongo database. How can I prevent this from happening?