Closed pcj closed 6 years ago
Changing the relation direction causes a slightly different stacktrace:
@Relationship(type = "INPUT", direction = Relationship.INCOMING)
public Set<String> inputs;
@Relationship(type = "OUTPUT", direction = Relationship.OUTGOING)
public Set<String> outputs;
java.lang.NullPointerException
at org.neo4j.ogm.context.EntityGraphMapper.bothWayMappingRequired(EntityGraphMapper.java:892)
at org.neo4j.ogm.context.EntityGraphMapper.mapEntityReferences(EntityGraphMapper.java:379)
at org.neo4j.ogm.context.EntityGraphMapper.mapEntity(EntityGraphMapper.java:230)
at org.neo4j.ogm.context.EntityGraphMapper.map(EntityGraphMapper.java:134)
at org.neo4j.ogm.session.delegates.SaveDelegate.save(SaveDelegate.java:83)
at org.neo4j.ogm.session.delegates.SaveDelegate.save(SaveDelegate.java:44)
at org.neo4j.ogm.session.Neo4jSession.save(Neo4jSession.java:419)
at org.springframework.data.neo4j.template.Neo4jTemplate.save(Neo4jTemplate.java:203)
Probably something I'm doing wrong, but certainly should not cause NPE.
Hello @pcj
The OGM does not support treating 'String' as a type of entity. You can:
@NodeEntity public class Something
with properties, to model your related node. Perhaps we can throw a more meaningful error message here?
It would be very helpful to show this note as part of the error message.
+1
I ran into this issue too. The EntityAccessManager's NullPointerException eventually lead me to this issue but only after spinning a bit to eliminate other things I thought could be the cause. Like @kamir, I had a List of non-@NodeEntity objects and, without experiencing this issue before, the NPE lead me in all sorts of other directions. A more meaningful error message would be a good thing.
Hi there,
I'm facing the same symptoms like pcj when trying to save a node. In my case it's probably caused due to a org.springframework.data.geo.Point property in my node. The same code worked perfectly fine while using:
After migrating to
in run into this issue. Any help or advice is appreciated.
import org.neo4j.ogm.annotation.NodeEntity;
import org.neo4j.ogm.annotation.typeconversion.DateLong;
import org.springframework.data.geo.Point;
import java.util.Date;
@NodeEntity
public class GpsLocationNode {
@GraphId
Long id;
@DateLong
private Date createTime = null;
private String locationid = null;
// Used with previous versions
// @Indexed(indexType = IndexType.POINT, indexName = "location")
private Point wkt = null;
private double latitude;
private double longitude;
private double radius;
private double altitude;
.... }
Any solution of this issue right now ?
This now prints a warning and advises user to check the mapping. Both in 2.1.x and 3+ versions.
New to neo4j, using with spring-data. Here's the stacktrace I'm seeing when trying to save a graph. If I don't populate the
inputs
oroutputs
Set(s), the exception does not occur. LMK if I can provide more information.Shooting from the hip as not familiar with the codebase at all, but perhaps there should be an assertion that ClassInfo is not null? Alternatively, perhaps this is an issue with
UNDIRECTED
?https://github.com/neo4j/neo4j-ogm/blob/master/core/src/main/java/org/neo4j/ogm/entity/io/EntityAccessManager.java#L349-L367
https://github.com/neo4j/neo4j-ogm/blob/master/core/src/main/java/org/neo4j/ogm/context/EntityGraphMapper.java#L880-L915
┆Issue is synchronized with this Asana task