Skip to content
This repository has been archived by the owner on May 3, 2021. It is now read-only.

dynamic properties #213

Closed
sergeily opened this issue Apr 25, 2020 · 6 comments
Closed

dynamic properties #213

sergeily opened this issue Apr 25, 2020 · 6 comments
Assignees

Comments

@sergeily
Copy link

it would be great to have dynamic-properties option such as OGM annotation @properties

ogm-manual

@meistermeier
Copy link
Contributor

(Sorry for the repetition of my comment on #214)
Could you give an example for an use-case?
In general it might make more sense to create a relationship to another node holding those informations. Dynamic properties are just a unsorted set of informations that somehow work around the idea of object mapping.

@meistermeier meistermeier added the blocked: missing information Further information is requested label Apr 26, 2020
@sergeily
Copy link
Author

Hi,

For each node we have explicit properties and auxiliary properties and we prefer to store these auxiliary properties as a separate collection.

When we use SDN+OGM it's possible to configure entity like


@NodeEntity(label="Column")
public class DaeColumnNode extends DaeNode {
    ......
    private String name;
    ......
    @Properties(prefix = "properties", allowCast = true)
    private Map<String, Object> properties;
    ......
}

And when we save node to neo4j Map<String, Object> would be save with prefix

name: columnNode2
properties.port: 8080
properties.timeZone: America/New_York

@meistermeier meistermeier added up-for-discussion and removed blocked: missing information Further information is requested labels Apr 27, 2020
@michael-simons
Copy link
Contributor

Hi.

That's a feature a lot of people like, actually. We are not against it either. Currently there seems to be work to have some similar in Spring Data commons. We will discuss this with Pivotal / VMWare.

Thank you!

@michael-simons michael-simons added dependencies enhancement New feature or request labels Apr 27, 2020
@michael-simons michael-simons self-assigned this May 7, 2020
@michael-simons
Copy link
Contributor

We have been thinking about having something more similar to @Embedded to have those properties in a domain specific, structured way. That would also remove the need for a context to see what properties are in the database and which are in the domain to keep them in sync.

@haris-zynka
Copy link
Contributor

haris-zynka commented May 14, 2020

This is quite good.
I have stuff that needs translation, and I tried Map<String,String> to have something like

{
  "en": "Stuff",
  "sv": "Objekt"
}

but it didn't work and as a temp workaround I added

data class LangThing (val en: String, val sv: String)

However, you can see the limitation of supporting every language would mean manually writing each field. There's some more stuff which I'd like dynamic as I take it as JSON from other servers and don't care about them just show them to the user.

Now I realised that you guys use Map<String,Object> for dynamic relationships If you use something as suggested @Embedded then:

  1. It's more semantic, developer actually knows that's an embedded document with dynamic properties and it's hard to confuse it with anything else - not having any annotation I guess could lead to unwanted results at some points and storing stuff mistakenly
  2. It clears out stuff when having dynamic embedded object and dynamic relationship

I suggest maybe @EmbeddedNode or @EmbeddedObject as I think I saw some @Embedded annotations before used by other frameworks in Java or I might be mistaking.

@meistermeier
Copy link
Contributor

Since we are in a migration process to the original Spring Data Neo4j and have to archive this repository, the issue also go migrated to: https://jira.spring.io/browse/DATAGRAPH-1347
Please watch or comment on the issue in Jira for further communication.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants