Skip to content
This repository has been archived by the owner on Jan 18, 2022. It is now read-only.

DynamicProperties implementation #8

Merged
merged 11 commits into from Sep 22, 2011
Merged

DynamicProperties implementation #8

merged 11 commits into from Sep 22, 2011

Conversation

ractive
Copy link
Contributor

@ractive 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.

@jexp
Copy link
Contributor

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.

@ractive
Copy link
Contributor Author

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

@ractive
Copy link
Contributor Author

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

@ractive
Copy link
Contributor Author

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 added a commit that referenced this pull request Sep 22, 2011
DynamicProperties implementation
@jexp jexp merged commit 755cb4d into spring-attic:master Sep 22, 2011
@jexp
Copy link
Contributor

jexp commented Sep 23, 2011

Thanks again for your effort!

@ractive
Copy link
Contributor Author

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

@jexp
Copy link
Contributor

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants