I feel like this is a basic concept, but I'm still not grokking how SpringData 
Neo4j 4.1 <https://github.com/spring-projects/spring-data-neo4j> works with 
Entity IDs.
I also am confused on how I should work with natural IDs for my domain 
objects. 

Background: I can run the sdn4-university example 
<https://github.com/neo4j-examples/sdn4-university/tree/4.1>, and I created 
a working Spring Boot app with two of my own domain objects based on the 
sdn-uni classes (no Angular), but do have relationships and do save to 
Neo4j. yay!

I heard loud and clear at GraphConnect to leave node/graph IDs alone, but 
how do they related to the Entity "id" property, and the "<id>" shown in 
Neo4j for each node? How does the JSOGGenerator fit in here? Maybe there is 
more info to share about that curious FIXME message that will help me 
understand? 


@JsonIdentityInfo(generator=JSOGGenerator.class)
public abstract class Entity {

    @JsonProperty("id")
    private Long id;


/**
 * FIXME:
 * This is the default mechanism for providing entity identity to the OGM
 *
 * It is required because the OGM can currently accept objects with NO
 * id value set. This is a restriction that must be changed
 *
 * @param o the object to compare, either or both may not yet be persisted.
 * @return
 */
@Override
public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || id == null || getClass() != o.getClass()) return false;

    Entity entity = (Entity) o;

    if (!id.equals(entity.id)) return false;

    return true;
}




FYI - I'm loading wiki space and a hierarchy of page objects for analysis 
into Neo4j. Each page has a unique integer ContentID that I want to use to 
store/retrieve the pages. Spaces have a unique string "key" that I want to 
use to store & retrieve them.

Puzzle #2: none of the domain objects in sdn4-university have @NodeEntity 
annotations as shown on the SpringData Neo4j 4.1 
<https://github.com/spring-projects/spring-data-neo4j> readme. That page 
also shows loading "Jon" by "id" - but doesn't show where we got "id". 

I'm starting to think "id" != "node id" and that I need to implement my own 
id property in Entity or sub-classes?

Thanks for explanation/feedback. :)
-Tim

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to