cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Access passed by param POJO object's properties in cypher query

Franbr31
Node Link

Hii! 😀

I have the following ClientNode object in Spring Boot marked with the @Node annotation:

 

@Node("Client")
@Getter
@Setter
public class ClientNode extends Entity {

private String propA;
private String propB;
private String propC;
private String propD;

 

I am implementing the following query passing as parameter a ClientNode list:

 

@Query("" +
"CALL apoc.periodic.iterate('" +
"WITH $insertReq as requests " +
"UNWIND requests as req " +
"RETURN req' " +
"," +
"'" +
"CREATE (n:Client{propA:req.propA, propB:req.propB, propC:req.propC," +
"propD:req.propD})" +
"' " +
"," +
"{ batchSize:1, parallel: true, params: {insertReq: $clientList} }) " +
"YIELD total, failedOperations, errorMessages " +
"RETURN *")
BatchOperationResponse bulkInsert(List<ClientNode> clientList);

The idea is to insert several clients using the apoc.periodic.iterate function, but the problem is that it does not correctly access the properties of the ClientNode objects passed as parameter.

Does anyone know the correct way to access the ClientNode properties within the iterate function?

Thank you in advance!

 

 

0 REPLIES 0