Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
03-31-2020 08:28 AM
Dear sirs or madams,
I want to create a merge like statement which either merges a Relationships with an existing one or creates one if not existing, is there any way to do this without querying before?
I want to create a MERGE statement programatically.
Is there any switch doing this in the code?
Entity entityFrom = entityRepo.findByID(nodeFrom);
Entity entityTo = entityRepo.findByID(nodeTo);
eERel.setNodeFrom(entityFrom);
eERel.setNodeTo(entityTo);
eERel.setType(type);
eERel.setSubType(subType);
eERel.setSource("MANUALLY CREATED");
List<ConnectionFromEntityToEntity> entityToEntities = new ArrayList();
entityToEntities.add(eERel);
entityFrom.setEntities_out(entityToEntities);
entityRepo.save(entityFrom);
type or paste code here
the Repository class looks like this:
@RelationshipEntity(type = "CONNECTION_TO")
public class ConnectionFromEntityToEntity {
@Id @GeneratedValue private Long id;
String type;
String subType;
@StartNode
Entity nodeFrom;
@EndNode
Entity nodeTo;
private String source;
Thank you very much in advance.
Kindest regards,
Malte
All the sessions of the conference are now available online