SpringData-Neo4j - the new value should be Set, was: class java.util.ArrayList

I am trying to save a domain object that contains fields like java.util.List. I am using springdata 3.2.0.RELEASE + Neo4j 2.1.2 and save the object using neo4jTemplate.save API.

Questions: How to handle a scenario in which the domoain object has a list.

rate your help

Utpal.

I get the following error:

INFO : org.springframework.data.neo4j.fieldaccess.DelegatingFieldAccessorFactory - No FieldAccessor configured for field: interface java.util.Set ratings rel: false idx: false
java.lang.IllegalArgumentException: New value must be a Set, was: class java.util.ArrayList
    at org.springframework.data.neo4j.fieldaccess.RelationshipHelper.createSetOfTargetNodes(RelationshipHelper.java:124)
    at org.springframework.data.neo4j.fieldaccess.RelatedToFieldAccessor.createSetOfTargetNodes(RelatedToFieldAccessor.java:82)
    at org.springframework.data.neo4j.fieldaccess.RelatedToCollectionFieldAccessorFactory$RelatedToCollectionFieldAccessor.setValue(RelatedToCollectionFieldAccessorFactory.java:66)
    at org.springframework.data.neo4j.fieldaccess.DefaultEntityState.setValue(DefaultEntityState.java:113)
+4
source share
1 answer

Use Set, not List. Neo4j does not support ordering.

This will help.

+1
source

All Articles