Hi this is my Receipt entity which contains Unit object with the following properties. My problem is that I dont want to create duplicate Unit nodes each time new Receipt is created instead just connect this Receipt to the already stored Unit with same properties.
Now I am using default save method inherited from Neo4jRepository class, but I would like to create query to accomplish that requirement I described above. Thanks.
@NodeEntity
public class Receipt {
@Id
@GeneratedValue
private Long id;
private Long ownerID;
private String friendlyName;
private String shop;
private String createdDateTime;
@Relationship("CONTAINS")
private ArrayList<Item> items;
@Relationship("ISSUED_AT")
private Unit unit;
private Double totalPrice;
@NodeEntity
public class Unit {
@Id
@GeneratedValue
private Long id;
private String buildingNumber;
private String municipality;
private String postalCode;
private String country;
private String street;