cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Cannot retrieve Map object with empty entry

Hi all,

class Cat {
    @Id @GeneratedValue private Long id;
    @Properties(prefix = "property", allowCast = true) private Map<String, Object> property;
}

Cat cat = new Cat();
Map<String, Object> map = new HashMap<>();
map.put("dummy", new HashMap<>());
cat.setProperty(map);
cat = catRepository.save(cat);
System.out.print(cat.getProperty().get("dummy")) // it is {}

// when I do this
Cat newCat = catRepository.findById(cat.getId());
System.out.print(newCat.getProperty().get("dummy")) // it is null

Why is it so?

1 REPLY 1

Dynamic properties only work for one level, not nested documents.

It only works by accident in the first case.