Skip to content

Commit

Permalink
[Fix] Single map to entity mapping.
Browse files Browse the repository at this point in the history
If there is only one map in the result,
that should represent a map field of an entity,
it wrongly got flat mapped and the key got dismissed.

This change limits the possibility of converting returned maps into entities because this would be a contradiction right now.
  • Loading branch information
meistermeier committed Jan 6, 2023
1 parent 9ca0fea commit fb6c355
Show file tree
Hide file tree
Showing 2 changed files with 217 additions and 156 deletions.
Expand Up @@ -51,7 +51,7 @@ public <T> T convert(MapAccessor record, Class<T> entityClass) {
Map<String, Object> recordMap = record.asMap();
if (recordMap.size() == 1) {
Value value = record.values().iterator().next();
if (value.type().equals(typeSystem.NODE()) || value.type().equals(typeSystem.MAP())) {
if (value.type().equals(typeSystem.NODE())) {
return objectInstantiator.createInstance(entityClass, converters).apply(value);
}
}
Expand Down

0 comments on commit fb6c355

Please sign in to comment.