Neo4j 4.2 graph repo save method is now ambiguous

Viewed 132

I have just updated from Spring Data Neo4j 4.1.3 to 4.2.7

But, I have not been able to get my project to start running again after changing the maven dependency.

I have fixed many issues as described in this tutorial: https://graphaware.com/neo4j/2016/09/30/upgrading-to-sdn-42.html But I cannot figure out why this issue has emerged.

In my service > GenericService.java > createOrUpdate

...
@Override
public T createOrUpdate(T entity) {
    getRepository().save(entity, DEPTH_ENTITY_NEXT); //ERROR LINE
    if (entity instanceof Entity)
        return find(((Entity) entity).getId());
    else if (entity instanceof GraphType)
        return find(((GraphType) entity).getId());
    else 
        return find(((DataType) entity).getId());
}
...

The getRepository line now gives the following error:

The method save(T, int) is ambiguous for the type 
    GraphRepository<T>

simply saving the graph repo seems to be erroring.

UPDATE

If I just try to Maven build the project even though eclipse shows the error. It prints this error:

Caused by: java.io.FileNotFoundException: class path resource [org/springframework/data/neo4j/config/Neo4jConfiguration.class] cannot be opened because it does not exist
1 Answers

You probably have a problem in your dependency management. Please see the templates for examples on how to configure your project.

Also note that GraphRepository is deprecated and replaced by Neo4jRepository<T, ID>.

Related