1

I do have a Repository

@Repository
public interface PointOfInterestRepository extends GraphRepository<Poi> {
    // currently empty
}

with no custom methods defined. So I use the like of save(T... entities) which are predefined.

And I have my Poi class as follows

@NodeEntity(label = "PointOfInterest")
public class Poi {

    @JsonIgnore
    @GraphId
    Long neo4jId;

    @JsonManagedReference("node-poi")
    @JsonProperty("node")
    @Relationship(type = "BELONGS_TO", direction = Relationship.UNDIRECTED)
    private Node node;

    @JsonProperty("id")
    @Property(name = "poiID")
    private final String id;

    @JsonProperty("uris")
    @Property(name = "uris")
    private final Set<URI> correspondingURIs = new HashSet<>();

   /* Some more stuff I skip here*/
}

with getters for the fields.

Currently I am able to save such Pois to neo4j and retrieve them back, but when I try to work with those Nodes in the database via cypher it appears that the fields aren't mapped to neo4j properties.

I thought spring-data-neo4j would convert my class fields to neo4j graph properties. Am I wrong with that?

Note: The save calls seems to work very well. After that I can see the Nodes in the database and calling findAll() afterwards will return me all the saved Nodes (Pois) properly with all the correct values. But somehow, within the database, I cannot see any properties/fields.

8
  • Not sure what your actual question is. What do you mean by " But somehow, within the database, I cannot see any properties/fields." and "but when I try to work with those Nodes in the database via cypher it appears that the fields aren't mapped to neo4j properties." ??? Commented Mar 26, 2016 at 16:45
  • When I log in to neo4j and try to execute cypher queries, i cannot access properties because they seems to being not there, does this help you?
    – Matthias
    Commented Mar 26, 2016 at 16:48
  • So you mean via the neo4j browser you see the nodes but there are no properties? And via SDN you can query and see the properties? Sorry for asking the same sort of question but hard to figure out what this is
    – Luanne
    Commented Mar 29, 2016 at 11:09
  • @Luanne yes, you figured it out.
    – Matthias
    Commented Mar 29, 2016 at 11:10
  • Are you using 4.0.0.RELEASE? Can you try removing the @JsonProperty annotation and see if it fixes the issue?
    – Luanne
    Commented Mar 29, 2016 at 11:17

1 Answer 1

3
+50

The problem is the final fields. SDN would be unable to write values back to the entity when loaded from the graph because these fields are final (and SDN will use only the default no-args constructor), and as such, final fields are not supported. Removing the final should fix this.

Not the answer you're looking for? Browse other questions tagged or ask your own question.