Java apoc.periodic.iterate( {params:{...}}) insert large scale of data

Hi,

I'm trying to execute the following Java code with apoc without success.
Can somebody assist me?


public interface IRelationRepository {

    @Query("call apoc.periodic.iterate("
            + "\"UNWIND $items as item return item "
            + "MERGE (s1:s{id:item.startNode.customId}) "
            + "WITH s1 "
            + "MERGE (e1:e{id:item.endNode.customId}) "
            + "MERGE (s1)-[r:item.type]->(e1) "
            + "RETURN r\", "
            + "\"SET r.id=item.customId, r.name=item.name\", "
            + "{batchSize:5000, parallel:true, iterateList:true, params:{items:$items}})")
    Result saveAll(@Param("items") List<?> items);
}

I also tried using:

...
            + "{batchSize:5000, parallel:true, iterateList:true, params:{items:{items}}})")
...

In general, what I want to do is to insert a large scale of data into Neo4j.
The solution I found is using apoc.periodic.iterate(...).
I saw examples in which load csv/json is being used. In my case scenario, I'm building the objects in the code. So to insert those objects into a CSV file seems to be a redundant (and expensive) step.

BTW, I saw the following topic:


and saw @michael.hunger replays there and in someplace over the web.
So if you can assist, it will be fantastic.

The errors I'm receiving:

2020-11-16T10:24:43,792 ERROR [grpc-default-executor-0] i.g.i.SerializingExecutor: Exception while executing runnable io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1HalfClosed@4950d342
java.lang.IllegalArgumentException: Infinite recursion (StackOverflowError) (through reference chain: org.orchestra.policyexplorer.data.nodes.CounterNode["countersMap"]->org.orchestra.policyexplorer.data.nodes.CounterNode["countersMap"]- ...
	at com.fasterxml.jackson.databind.ObjectMapper._convert(ObjectMapper.java:3938)
	at com.fasterxml.jackson.databind.ObjectMapper.convertValue(ObjectMapper.java:3879)
	a

Thanks in advance,
Boris