Current scenario:
User is able to have a Car and a Motorcycle, so a user could have 1 relation [:OWNS] :Car and another to :Motorcycle. It is also possible for the user to have neither or just one of them.
U->C & U->M
U->C
U
Current relationship entity:
@RelationshipEntity(type = "OWNS")
public class Owns {
@GraphId
Long relationshipId;
private int price;
@StartNode
Car car;
@EndNode
Motorcycle motor;
}
How do I set a user to have just one of them? because I get error that an EndNode cannot be null, which understandable at this point. is there a way to make another endNode optional?
Thanks