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.

How to Update Relationship In SDN 6 ?

Currently, We're working on OGM base implementation. We like to move on SDN 6 But I face problem to update relationship by neo4jRepository. I mention domain model.

 

 

@Node
public class Activity {
    @Id
    @GeneratedValue
    protected Long graphId;
    private String guid;
    @Relationship(type = "PARENT_OF", direction = Direction.OUTGOING)
    private Set<Activity> children;
    
     public void addChild(Activity child) {
      this.children.add(child);
    }
    public void removeChild(Activity child) {
     this.children.remove(child);
    }

}
public interface ActivityReadRepository extends Neo4jRepository<Activity, Long>{
}
@Component
public class RunableClass implements CommandLineRunner{
 @Autowired
    ActivityRepository activityRepository;
@Override
    public void run(String... args) throws Exception {
Activity parent = activityRepository.findByGuid("xxx-xxx-xxx-xxx-xxx")

Activity child = activityRepository.findByGuid("xxx-xxx-xxx-xxx-xxx1")

parent.removeChild(child);
activityRepository.save(parent);



}
 
}

 

 

After used save() Method, All Child `PARENT_OF`  relationship will be removed. That above code working fine in SDN+OGM, but it does not work on SDN 6. 


0 REPLIES 0