You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
then empty Maps and Lists are stored as well to DB.
They also get deserialized as empty Maps resp. List again.
This works for an empty
Map<String, String>
BUT it does not work for empty Maps like the following
Map<String, List<String>>
Map<String, MyObject>
where
class MyObject {
private String valueA;
private int valueB;
}
It seems when having a complex type in the value part of the map, the map is no longer deserialized as empty map but simply as null object, which subsequently breaks the code as they are no longer equal after loading.
Tested with Morphia 1.0.1
The text was updated successfully, but these errors were encountered:
The issue seems to be that EmbeddedMapper#readMap doesn't take its MapperOptions' isStoreEmpties flag into account when deciding whether to set the map field's value. This doesn't occur for simple valued maps because a different Mapper implementation is used.
I've created a pull request with the necessary changes here #869.
When configuring the mapper to also store empties
then empty Maps and Lists are stored as well to DB.
They also get deserialized as empty Maps resp. List again.
This works for an empty
BUT it does not work for empty Maps like the following
where
It seems when having a complex type in the value part of the map, the map is no longer deserialized as empty map but simply as null object, which subsequently breaks the code as they are no longer equal after loading.
Tested with Morphia 1.0.1
The text was updated successfully, but these errors were encountered: