Conversation
…ted RelationshipDelegatingFieldAccessorFactory
The problem with detached entities is that they don't have a writable node to refer to. We discussed creating a layer above the neo4j nodes and relationships to handle that seamlessy but haven't created a PoC for that yet. |
A node would not be needed in this case to holde the dynamic properties in detached mode. The ManagedPrefixedDynamicProperties container that is created in the DynamicPropertiesFieldAccessor could also be used in detached mode to store them and write them to the node as soon as it is available. I have to admit that I did not spend very much time to find a solution for this. And I can live with that. :-) |
…ies in detached mode
The last changeset now allows having DynamicProperties on a detached node when using DynamicPropertiesContainer in the NodeEntity as: @NodeEntity
public class Person {
public DynamicProperties props = new DynamicPropertiesContainer();
}
Person p = new Person();
p.props.setProperty("foo", "bar");
p.persist(); |
…methods from the base class
…Accessors. The DetachedEntityState gets such a default implementation for a field in detached state.
The last checkin allows to have DynamicProperties set in detached mode without having to declare a default value/implementation in the entity class: @NodeEntity
public class Person {
public DynamicProperties props;
}
Person p = new Person();
p.props.setProperty("foo", "bar");
p.persist(); The FieldAccessor provides the default implementation (DynamicPropertiesContainer) in this case. |
Thanks again for your effort! |
Your welcome. It's always a good feeling to also give something back. :-) You may once again review these changes here. The semantic of DetachedEntityState#getValue changed so that not always null is returned when the node is detached. I think it has no unwanted side-effects, but you may want to think through it once again. ;-) |
Yeah I'll probably change that a bit to move this responsibility, because it is mostly type-dependent and not so much per field. But I'm not sure about the best way to do it. |
DynamicProperties implementation as described here: http://forum.springsource.org/showthread.php?112526
See the tests in DynamicPropertiesTest to get an idea how these DynamicProperties can be used.