0

I constructed an EMF model that should dictate the types of entities that are allowed to be stored in a Neo4J database instance.

I then wanted to annotate the EMF model classes with Neo4J OGM (version 3.2.28) to keep the connection to Neo4J as easy as possible.

It looks something like this:

Example EMF model

BaseElement and ToolNameArtefact are abstract. The field uuid in BaseElementImpl is annotated with org.neo4j.ogm.annotation.Id.

Now, when I try to store an instance of ConcreteArtefact via Session#save(), I get the following error message:

org.neo4j.ogm.exception.core.MappingException: Field with primary id is null for entity foo.bar.ConcreteArtefact@64d43929 (uuid: 7745782f-2c61-4450-985a-8cf2986afa49, projectName: ) at org.neo4j.ogm.context.MappingContext.nativeId(MappingContext.java:556) at org.neo4j.ogm.cypher.compiler.CypherContext.getIdentity(CypherContext.java:66) at org.neo4j.ogm.cypher.compiler.CypherContext.visitedNode(CypherContext.java:90) at org.neo4j.ogm.context.EntityGraphMapper.mapEntity(EntityGraphMapper.java:267) at org.neo4j.ogm.context.EntityGraphMapper.map(EntityGraphMapper.java:170) at org.neo4j.ogm.session.delegates.SaveDelegate.lambda$save$1(SaveDelegate.java:89) at java.util.Collections$SingletonList.forEach(Collections.java:4822) at org.neo4j.ogm.session.delegates.SaveDelegate.save(SaveDelegate.java:89) at org.neo4j.ogm.session.Neo4jSession.save(Neo4jSession.java:479)

Although the uuid field is clearly set.

Other solution proposals

My package names are all lower-case.

Moving the NodeEntity annotations to the interfaces instead of the implementing classes did not help.

The classes in question have a no-arg constructor.

1 Answer 1

0

This behavior was a problem with Neo4J OGM itself. A developer answered in this thread, that the issue will be fixed in future versions (starting from 3.2.29)

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