DynamicProperties implementation #8

Merged
merged 11 commits into from Sep 22, 2011

Conversation

Projects
None yet
2 participants
Contributor

ractive commented Sep 6, 2011

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.

Member

jexp commented Sep 6, 2011

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.

Contributor

ractive commented Sep 8, 2011

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. :-)

Contributor

ractive commented Sep 13, 2011

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();
Contributor

ractive commented Sep 19, 2011

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.

@jexp jexp added a commit that referenced this pull request Sep 22, 2011

@jexp jexp Merge pull request #8 from ractive/master
DynamicProperties implementation
755cb4d

@jexp jexp merged commit 755cb4d into spring-projects:master Sep 22, 2011

Member

jexp commented Sep 23, 2011

Thanks again for your effort!

Contributor

ractive commented Sep 23, 2011

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. ;-)

Member

jexp commented Sep 23, 2011

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment