Hello,
I’m quite new to SDN on Java and I could not find an explanation about how this works.
I have the current java :
@Node
public class Application {
@Id
private String name;
@Relationship(type = "EXPOSES", cascadeUpdate=false)
private List<Endpoint> endpoints;
@Relationship(type = "CALLS_HTTP", cascadeUpdate=false)
private List<CallHttp> callsHttp;
where Endpoint is another entity and CallHttps is a @RelationshipProperties class.
I kept the example quite simple.
The issue that I enconter is the following :
Let’s imagine that I currently have an Application which name is : “app1” having already endpoint1 and endpoint2. It also has 2 relations of type CallHttp callHttp1 and callHttp2 for example.
Then I want to update the node Application. To do that, first I get my Application “app1” using findOne(Example).
Once I got it, I do my processing which creates two new lists:
tempEndpoints = endpoint3
tempCallsHttp = callHttp3 callHttp4
(All objects are new entities, uuid (@Id) is equal to null)
I set the new lists on the entity that I got doing setEndpoints(tempEndpoints ) and setCallsHttp(tempCallsHttp).
Then I do repository.save to update app1.
What I would like to happen is :
The updated entity should have :
endpoints = endpoint3
callsHttp = callHttp3 callHttp4
What it really happens :
endpoints = endpoint3
callsHttp = callHttp1 callsHttp2 callHttp3 callsHttp4
SDN did not deleted callHttp1 callHttp2 for callsHttp list but for endpoints, it did what I was expecting for.
Is this normal ? Am I doing something wrong ?
Thank you.