Thursday, 19 September 2013

spring data neo4j DynamicProperties

spring data neo4j DynamicProperties

I have a NodeEntity with dynamic properties that looks like:
@NodeEntity
public class MyObject {
@GraphId
private Long id;
@Indexed
private String name;
DynamicProperties props = new DynamicPropertiesContainer();
public MyObject(String name) {
this.name = name;
}
// getters and setters for name
}
And then I try setting some dynamic properties like:
MyObject m = new MyObject("Jeff");
myRepo.save(m); // myRepo just extends GraphRepository
// I have also tried setting the dynamic property before saving it
m.props.setProperty("mydynamicproperty","somevalue");
MyObject persisted = myRepo.getAllObjects().iterator().next();
System.out.println(persisted.props.asMap()); // THIS IS EMPTY
name is set, but the properties are empty. According to the docs, I think
this should work? Any idea why it doesn't?

No comments:

Post a Comment