I have a problem with save node in cascade. I have a 3 #NodeEntity: Event, Tag, UserNeo. When I save next event, the previous relationship was deleted between user and events, and also between events and tag. Sometimes this relations are saved. I don't know what I doing wrong.
Neo4j dependency
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-neo4j</artifactId>
<version>4.2.0.BUILD-SNAPSHOT</version>
</dependency>
Event.java
#NodeEntity(label = "Event")
public class Event {
#GraphId
private Long id;
#Property(name = "title")
private String title;
#Property(name = "short_description")
private String shortDescription;
#Property(name = "long_description")
private String longDescription;
#Property(name = "address")
private String address;
#Property(name = "lat")
private double lat;
#Property(name = "lon")
private double lon;
#Property(name = "time")
#DateLong
private Date time;
#Property(name = "nuts")
private int nuts;
#Property(name = "created_by")
private String createdBy;
#Property(name = "created_date")
#DateLong
private Date createdDate;
#Property(name = "modified_by")
private String modifiedBy;
#Property(name = "modified_date")
#DateLong
private Date modifiedDate;
#Property(name = "deleted_date")
#DateLong
private Date deletedDate = null;
#Relationship(type = "TAGGED", direction = Relationship.OUTGOING)
private Set<Tag> tagSet = new HashSet<>();
#Relationship(type = "JOINED_IN", direction = Relationship.INCOMING)
private Set<UserNeo> joinedUsers = new HashSet<>();
#Relationship(type = "ORGANIZED", direction = Relationship.INCOMING)
private Set<UserNeo> organizedUsers;
// getters and setters
UserNeo.java
#NodeEntity(label = "User")
public class UserNeo {
#GraphId
private Long id;
#Property(name = "first_name")
private String firstName;
#Property(name = "last_name")
private String lastName;
#Property(name = "email")
private String email;
#Property(name = "vip")
private boolean vip;
#Property(name = "nuts")
private int nuts;
#Property(name = "current_lat")
private double currentLat;
#Property(name = "current_lon")
private double currentLon;
#Property(name = "created_date")
#DateLong
private Date createdDate;
#Property(name = "deleted_date")
#DateLong
private Date deletedDate;
#Relationship(type = "JOINED_IN", direction = Relationship.OUTGOING)
private List<Event> joinEvents;
#Relationship(type = "ORGANIZED", direction = Relationship.OUTGOING)
private List<Event> organizeEvents;
// getters and setters
Tag.java
#NodeEntity(label = "Tag")
public class Tag {
#GraphId
private Long id;
#Property(name = "tag")
private String tag;
#Relationship(type = "TAGGED", direction = Relationship.INCOMING)
private Set<Event> events = new HashSet<>();
// getters and setters
My service method to save nodes
public Event createEvent(EventDTO event){
Set<Tag> tags = new HashSet<>(event.getTagSet().size());
Iterator it = event.getTagSet().iterator();
while(it.hasNext()){
String tag = it.next().toString();
Tag resultTag = tagRepository.findByName(tag);
if(resultTag != null){
tags.add(resultTag);
}else {
Tag newTag = new Tag(tag);
newTag = tagRepository.save(newTag);
tags.add(newTag);
}
}
UserNeo userNeo = userNeoRepository.findByEmail("sunday1601#gmail.com");
Set<UserNeo> userNeos = new HashSet<>();
userNeos.add(userNeo);
Event createEvent = new `Event(event.getTitle(),event.getShortDescription(),event.getLongDescription(),`
event.getAddress(),event.getLat(),event.getLon(),event.getTime(),event.getNuts(),
event.getCreatedBy(), new Timestamp(new Date().getTime()),null,null);
createEvent.setTagSet(tags);
createEvent.setOrganizedUsers(userNeos);
Event save = eventRepository.save(createEvent);
return save;
}
When I save in short time, then delete previous relationship. And when I watch in neo4j browser I have a two the same event node.
This is log from jhipster
2016-07-14 22:04:42.863 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.MetaData : looking for concrete class to resolve label: User
2016-07-14 22:04:42.863 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.MetaData : concrete class found: com.mycompany.myapp.domain.UserNeo. comparing with what's already been found previously...
2016-07-14 22:04:42.863 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.MetaData : User resolving class: com.mycompany.myapp.domain.UserNeo
2016-07-14 22:04:42.863 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.GraphEntityMapper : Unable to find property: address on class: com.mycompany.myapp.domain.UserNeo for writing
2016-07-14 22:04:42.864 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : context-init: ($3153)-[:ORGANIZED]->($2108)
2016-07-14 22:04:42.864 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : context-init: ($2108)-[:TAGGED]->($2098)
2016-07-14 22:04:42.864 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : context-init: ($2108)-[:TAGGED]->($2100)
2016-07-14 22:04:42.864 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : context initialised with 3 relationships
2016-07-14 22:04:42.864 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : visiting: Event{id=null, title='Event 47', shortDescription='Opis krotki short', longDescription='Opis długi long', address='address 5', lat=50.000452, lon=20.957071, time=Sun Jun 18 01:07:34 CEST 2017, nuts=17, createdBy='Michal Niedziela', createdDate=2016-07-14 22:04:42.863, modifiedBy='null', modifiedDate=null, deletedDate=1970-01-01 01:00:00.0, tagSet=[Tag{id=2100, tag='Rock'}, Tag{id=2098, tag='Festiwal'}, Tag{id=3231, tag='Plaża'}], joinedUsers=[], organizedUsers=[UserNeo{id=3153, firstName='Michal', lastName='Niedziela', email='sunday1601#gmail.com', vip=false, nuts=100, currentLat=50.028797, currentLon=21.000123, createdDate=Tue Jul 12 11:07:55 CEST 2016, deletedDate=null, joinEvents=null, organizeEvents=null}]}
2016-07-14 22:04:42.864 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : Event{id=null, title='Event 47', shortDescription='Opis krotki short', longDescription='Opis długi long', address='address 5', lat=50.000452, lon=20.957071, time=Sun Jun 18 01:07:34 CEST 2017, nuts=17, createdBy='Michal Niedziela', createdDate=2016-07-14 22:04:42.863, modifiedBy='null', modifiedDate=null, deletedDate=1970-01-01 01:00:00.0, tagSet=[Tag{id=2100, tag='Rock'}, Tag{id=2098, tag='Festiwal'}, Tag{id=3231, tag='Plaża'}], joinedUsers=[], organizedUsers=[UserNeo{id=3153, firstName='Michal', lastName='Niedziela', email='sunday1601#gmail.com', vip=false, nuts=100, currentLat=50.028797, currentLon=21.000123, createdDate=Tue Jul 12 11:07:55 CEST 2016, deletedDate=null, joinEvents=null, organizeEvents=null}]} has changed
2016-07-14 22:04:42.866 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : mapping references declared by: Event{id=null, title='Event 47', shortDescription='Opis krotki short', longDescription='Opis długi long', address='address 5', lat=50.000452, lon=20.957071, time=Sun Jun 18 01:07:34 CEST 2017, nuts=17, createdBy='Michal Niedziela', createdDate=2016-07-14 22:04:42.863, modifiedBy='null', modifiedDate=null, deletedDate=1970-01-01 01:00:00.0, tagSet=[Tag{id=2100, tag='Rock'}, Tag{id=2098, tag='Festiwal'}, Tag{id=3231, tag='Plaża'}], joinedUsers=[], organizedUsers=[UserNeo{id=3153, firstName='Michal', lastName='Niedziela', email='sunday1601#gmail.com', vip=false, nuts=100, currentLat=50.028797, currentLon=21.000123, createdDate=Tue Jul 12 11:07:55 CEST 2016, deletedDate=null, joinEvents=null, organizeEvents=null}]}
2016-07-14 22:04:42.866 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : mapping reference type: TAGGED
2016-07-14 22:04:42.866 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : linking to entity Tag{id=2100, tag='Rock'} in one direction
2016-07-14 22:04:42.867 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : visiting: Tag{id=2100, tag='Rock'}
2016-07-14 22:04:42.867 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : Tag{id=2100, tag='Rock'}, has not changed
2016-07-14 22:04:42.867 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : mapping references declared by: Tag{id=2100, tag='Rock'}
2016-07-14 22:04:42.867 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : context-del: (2100)<-[:TAGGED]-()
2016-07-14 22:04:42.867 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : mapping reference type: TAGGED
2016-07-14 22:04:42.867 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : trying to map relationship between Event{id=null, title='Event 47', shortDescription='Opis krotki short', longDescription='Opis długi long', address='address 5', lat=50.000452, lon=20.957071, time=Sun Jun 18 01:07:34 CEST 2017, nuts=17, createdBy='Michal Niedziela', createdDate=2016-07-14 22:04:42.863, modifiedBy='null', modifiedDate=null, deletedDate=1970-01-01 01:00:00.0, tagSet=[Tag{id=2100, tag='Rock'}, Tag{id=2098, tag='Festiwal'}, Tag{id=3231, tag='Plaża'}], joinedUsers=[], organizedUsers=[UserNeo{id=3153, firstName='Michal', lastName='Niedziela', email='sunday1601#gmail.com', vip=false, nuts=100, currentLat=50.028797, currentLon=21.000123, createdDate=Tue Jul 12 11:07:55 CEST 2016, deletedDate=null, joinEvents=null, organizeEvents=null}]} and Tag{id=2100, tag='Rock'}
2016-07-14 22:04:42.867 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : context-new: (-250914077)-[-1950378672:TAGGED]->(2100)
2016-07-14 22:04:42.867 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : linking to entity Tag{id=2098, tag='Festiwal'} in one direction
2016-07-14 22:04:42.867 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : visiting: Tag{id=2098, tag='Festiwal'}
2016-07-14 22:04:42.867 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : Tag{id=2098, tag='Festiwal'}, has not changed
2016-07-14 22:04:42.872 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : mapping references declared by: Tag{id=2098, tag='Festiwal'}
2016-07-14 22:04:42.872 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : context-del: (2098)<-[:TAGGED]-()
2016-07-14 22:04:42.872 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : mapping reference type: TAGGED
2016-07-14 22:04:42.872 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : trying to map relationship between Event{id=null, title='Event 47', shortDescription='Opis krotki short', longDescription='Opis długi long', address='address 5', lat=50.000452, lon=20.957071, time=Sun Jun 18 01:07:34 CEST 2017, nuts=17, createdBy='Michal Niedziela', createdDate=2016-07-14 22:04:42.863, modifiedBy='null', modifiedDate=null, deletedDate=1970-01-01 01:00:00.0, tagSet=[Tag{id=2100, tag='Rock'}, Tag{id=2098, tag='Festiwal'}, Tag{id=3231, tag='Plaża'}], joinedUsers=[], organizedUsers=[UserNeo{id=3153, firstName='Michal', lastName='Niedziela', email='sunday1601#gmail.com', vip=false, nuts=100, currentLat=50.028797, currentLon=21.000123, createdDate=Tue Jul 12 11:07:55 CEST 2016, deletedDate=null, joinEvents=null, organizeEvents=null}]} and Tag{id=2098, tag='Festiwal'}
2016-07-14 22:04:42.873 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : context-new: (-250914077)-[-1648969869:TAGGED]->(2098)
2016-07-14 22:04:42.873 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : linking to entity Tag{id=3231, tag='Plaża'} in one direction
2016-07-14 22:04:42.873 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : visiting: Tag{id=3231, tag='Plaża'}
2016-07-14 22:04:42.873 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : Tag{id=3231, tag='Plaża'}, has not changed
2016-07-14 22:04:42.873 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : mapping references declared by: Tag{id=3231, tag='Plaża'}
2016-07-14 22:04:42.873 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : context-del: (3231)<-[:TAGGED]-()
2016-07-14 22:04:42.873 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : mapping reference type: TAGGED
2016-07-14 22:04:42.873 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : trying to map relationship between Event{id=null, title='Event 47', shortDescription='Opis krotki short', longDescription='Opis długi long', address='address 5', lat=50.000452, lon=20.957071, time=Sun Jun 18 01:07:34 CEST 2017, nuts=17, createdBy='Michal Niedziela', createdDate=2016-07-14 22:04:42.863, modifiedBy='null', modifiedDate=null, deletedDate=1970-01-01 01:00:00.0, tagSet=[Tag{id=2100, tag='Rock'}, Tag{id=2098, tag='Festiwal'}, Tag{id=3231, tag='Plaża'}], joinedUsers=[], organizedUsers=[UserNeo{id=3153, firstName='Michal', lastName='Niedziela', email='sunday1601#gmail.com', vip=false, nuts=100, currentLat=50.028797, currentLon=21.000123, createdDate=Tue Jul 12 11:07:55 CEST 2016, deletedDate=null, joinEvents=null, organizeEvents=null}]} and Tag{id=3231, tag='Plaża'}
2016-07-14 22:04:42.873 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : context-new: (-250914077)-[-1054618601:TAGGED]->(3231)
2016-07-14 22:04:42.873 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : mapping reference type: ORGANIZED
2016-07-14 22:04:42.873 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : linking to entity UserNeo{id=3153, firstName='Michal', lastName='Niedziela', email='sunday1601#gmail.com', vip=false, nuts=100, currentLat=50.028797, currentLon=21.000123, createdDate=Tue Jul 12 11:07:55 CEST 2016, deletedDate=null, joinEvents=null, organizeEvents=null} in one direction
2016-07-14 22:04:42.873 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : visiting: UserNeo{id=3153, firstName='Michal', lastName='Niedziela', email='sunday1601#gmail.com', vip=false, nuts=100, currentLat=50.028797, currentLon=21.000123, createdDate=Tue Jul 12 11:07:55 CEST 2016, deletedDate=null, joinEvents=null, organizeEvents=null}
2016-07-14 22:04:42.874 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : UserNeo{id=3153, firstName='Michal', lastName='Niedziela', email='sunday1601#gmail.com', vip=false, nuts=100, currentLat=50.028797, currentLon=21.000123, createdDate=Tue Jul 12 11:07:55 CEST 2016, deletedDate=null, joinEvents=null, organizeEvents=null}, has not changed
2016-07-14 22:04:42.874 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : mapping references declared by: UserNeo{id=3153, firstName='Michal', lastName='Niedziela', email='sunday1601#gmail.com', vip=false, nuts=100, currentLat=50.028797, currentLon=21.000123, createdDate=Tue Jul 12 11:07:55 CEST 2016, deletedDate=null, joinEvents=null, organizeEvents=null}
2016-07-14 22:04:42.874 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : context-del: (3153)-[:JOINED_IN]->()
2016-07-14 22:04:42.874 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : context-del: (3153)-[:ORGANIZED]->()
2016-07-14 22:04:42.874 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : trying to map relationship between Event{id=null, title='Event 47', shortDescription='Opis krotki short', longDescription='Opis długi long', address='address 5', lat=50.000452, lon=20.957071, time=Sun Jun 18 01:07:34 CEST 2017, nuts=17, createdBy='Michal Niedziela', createdDate=2016-07-14 22:04:42.863, modifiedBy='null', modifiedDate=null, deletedDate=1970-01-01 01:00:00.0, tagSet=[Tag{id=2100, tag='Rock'}, Tag{id=2098, tag='Festiwal'}, Tag{id=3231, tag='Plaża'}], joinedUsers=[], organizedUsers=[UserNeo{id=3153, firstName='Michal', lastName='Niedziela', email='sunday1601#gmail.com', vip=false, nuts=100, currentLat=50.028797, currentLon=21.000123, createdDate=Tue Jul 12 11:07:55 CEST 2016, deletedDate=null, joinEvents=null, organizeEvents=null}]} and UserNeo{id=3153, firstName='Michal', lastName='Niedziela', email='sunday1601#gmail.com', vip=false, nuts=100, currentLat=50.028797, currentLon=21.000123, createdDate=Tue Jul 12 11:07:55 CEST 2016, deletedDate=null, joinEvents=null, organizeEvents=null}
2016-07-14 22:04:42.874 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : context-new: (3153)-[-1646367736:ORGANIZED]->(-250914077)
2016-07-14 22:04:42.874 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : mapping reference type: JOINED_IN
2016-07-14 22:04:42.874 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : context-del: ($3153)-[null:ORGANIZED]->($2108)
2016-07-14 22:04:42.874 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : flushing end node of: ($3153)-[:ORGANIZED]->($2108)
2016-07-14 22:04:42.874 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : flushing start node of: ($3153)-[:ORGANIZED]->($2108)
2016-07-14 22:04:42.874 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : context-del: ($2108)-[null:TAGGED]->($2098)
2016-07-14 22:04:42.874 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : flushing end node of: ($2108)-[:TAGGED]->($2098)
2016-07-14 22:04:42.874 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : flushing end node of: ($2108)-[:TAGGED]->($2100)
2016-07-14 22:04:42.874 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.context.EntityGraphMapper : context-del: ($2108)-[null:TAGGED]->($2100)
2016-07-14 22:04:42.875 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.session.Neo4jSession : Thread 41: beginTransaction()
2016-07-14 22:04:42.875 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.session.Neo4jSession : Thread 41: Neo4jSession identity: org.neo4j.ogm.session.delegates.TransactionsDelegate#32786293
2016-07-14 22:04:42.875 DEBUG 26162 --- [nio-8080-exec-5] o.n.ogm.drivers.http.driver.HttpDriver : Thread 41: POST http://localhost:7474/db/data/transaction
2016-07-14 22:04:42.875 INFO 26162 --- [nio-8080-exec-5] o.n.o.drivers.http.request.HttpRequest : Thread 41: POST http://localhost:7474/db/data/transaction HTTP/1.1
2016-07-14 22:04:42.876 DEBUG 26162 --- [nio-8080-exec-5] o.n.o.drivers.http.request.HttpRequest : Thread 41: HttpResponse HttpResponseProxy{HTTP/1.1 201 Created [Date: Thu, 14 Jul 2016 20:04:42 GMT, Location: http://localhost:7474/db/data/transaction/531, Content-Type: application/json, Access-Control-Allow-Origin: *, Content-Length: 150, Server: Jetty(9.2.9.v20150224)] ResponseEntityProxy{[Content-Type: application/json,Content-Length: 150,Chunked: false]}}
2016-07-14 22:04:42.881 DEBUG 26162 --- [nio-8080-exec-5] o.n.ogm.drivers.http.driver.HttpDriver : Thread 41: {"commit":"http://localhost:7474/db/data/transaction/531/commit","results":[],"transaction":{"expires":"Thu, 14 Jul 2016 20:05:42 +0000"},"errors":[]}
2016-07-14 22:04:42.882 DEBUG 26162 --- [nio-8080-exec-5] o.n.ogm.drivers.http.driver.HttpDriver : Thread 41: Connection released
2016-07-14 22:04:42.884 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.session.Neo4jSession : Thread 41: Transaction, tx id: org.neo4j.ogm.drivers.http.transaction.HttpTransaction#39e7461a
2016-07-14 22:04:42.884 DEBUG 26162 --- [nio-8080-exec-5] o.n.ogm.drivers.http.driver.HttpDriver : Thread 41: request url http://localhost:7474/db/data/transaction/531
2016-07-14 22:04:42.884 INFO 26162 --- [nio-8080-exec-5] o.n.o.drivers.http.request.HttpRequest : Thread 41: request {"statements":[{"statement":"UNWIND {rows} as row CREATE (n:`Event`) SET n=row.props RETURN row.nodeRef as ref, ID(n) as id, row.type as type","parameters":{"rows":[{"nodeRef":-250914077,"type":"node","props":{"short_description":"Opis krotki short","deleted_date":0,"address":"address 5","nuts":17,"lon":20.957071,"created_date":1468526682863,"time":1497740854000,"long_description":"Opis długi long","title":"Event 47","created_by":"Michal Niedziela","lat":50.000452}}]},"resultDataContents":["row"],"includeStats":false}]}
2016-07-14 22:04:42.885 INFO 26162 --- [nio-8080-exec-5] o.n.o.drivers.http.request.HttpRequest : Thread 41: POST http://localhost:7474/db/data/transaction/531 HTTP/1.1
2016-07-14 22:04:42.889 DEBUG 26162 --- [nio-8080-exec-5] o.n.o.drivers.http.request.HttpRequest : Thread 41: HttpResponse HttpResponseProxy{HTTP/1.1 200 OK [Date: Thu, 14 Jul 2016 20:04:42 GMT, Content-Type: application/json, Access-Control-Allow-Origin: *, Content-Length: 247, Server: Jetty(9.2.9.v20150224)] ResponseEntityProxy{[Content-Type: application/json,Content-Length: 247,Chunked: false]}}
2016-07-14 22:04:42.889 DEBUG 26162 --- [nio-8080-exec-5] o.n.o.d.h.response.AbstractHttpResponse : Thread 41: Releasing HttpResponse
2016-07-14 22:04:42.889 DEBUG 26162 --- [nio-8080-exec-5] o.n.ogm.session.request.RequestExecutor : to create: nodeEntity -250914077:2109
2016-07-14 22:04:42.889 DEBUG 26162 --- [nio-8080-exec-5] o.n.ogm.drivers.http.driver.HttpDriver : Thread 41: request url http://localhost:7474/db/data/transaction/531
2016-07-14 22:04:42.890 INFO 26162 --- [nio-8080-exec-5] o.n.o.drivers.http.request.HttpRequest : Thread 41: request {"statements":[{"statement":"UNWIND {rows} as row MATCH (startNode) WHERE ID(startNode) = row.startNodeId MATCH (endNode) WHERE ID(endNode) = row.endNodeId MERGE (startNode)-[rel:`TAGGED`]->(endNode) RETURN row.relRef as ref, ID(rel) as id, row.type as type","parameters":{"rows":[{"startNodeId":2109,"relRef":-1054618601,"type":"rel","endNodeId":3231},{"startNodeId":2109,"relRef":-1648969869,"type":"rel","endNodeId":2098},{"startNodeId":2109,"relRef":-1950378672,"type":"rel","endNodeId":2100}]},"resultDataContents":["row"],"includeStats":false},{"statement":"UNWIND {rows} as row MATCH (startNode) WHERE ID(startNode) = row.startNodeId MATCH (endNode) WHERE ID(endNode) = row.endNodeId MERGE (startNode)-[rel:`ORGANIZED`]->(endNode) RETURN row.relRef as ref, ID(rel) as id, row.type as type","parameters":{"rows":[{"startNodeId":3153,"relRef":-1646367736,"type":"rel","endNodeId":2109}]},"resultDataContents":["row"],"includeStats":false},{"statement":"UNWIND {rows} as row MATCH (startNode) WHERE ID(startNode) = row.startNodeId MATCH (endNode) WHERE ID(endNode) = row.endNodeId MATCH (startNode)-[rel:`ORGANIZED`]->(endNode) DELETE rel","parameters":{"rows":[{"startNodeId":3153,"endNodeId":2108}]},"resultDataContents":["row"],"includeStats":false},{"statement":"UNWIND {rows} as row MATCH (startNode) WHERE ID(startNode) = row.startNodeId MATCH (endNode) WHERE ID(endNode) = row.endNodeId MATCH (startNode)-[rel:`TAGGED`]->(endNode) DELETE rel","parameters":{"rows":[{"startNodeId":2108,"endNodeId":2098},{"startNodeId":2108,"endNodeId":2100}]},"resultDataContents":["row"],"includeStats":false}]}
2016-07-14 22:04:42.891 INFO 26162 --- [nio-8080-exec-5] o.n.o.drivers.http.request.HttpRequest : Thread 41: POST http://localhost:7474/db/data/transaction/531 HTTP/1.1
2016-07-14 22:04:42.895 DEBUG 26162 --- [nio-8080-exec-5] o.n.o.drivers.http.request.HttpRequest : Thread 41: HttpResponse HttpResponseProxy{HTTP/1.1 200 OK [Date: Thu, 14 Jul 2016 20:04:42 GMT, Content-Type: application/json, Access-Control-Allow-Origin: *, Content-Length: 505, Server: Jetty(9.2.9.v20150224)] ResponseEntityProxy{[Content-Type: application/json,Content-Length: 505,Chunked: false]}}
2016-07-14 22:04:42.895 DEBUG 26162 --- [nio-8080-exec-5] o.n.o.d.h.response.AbstractHttpResponse : Thread 41: Releasing HttpResponse
2016-07-14 22:04:42.896 DEBUG 26162 --- [nio-8080-exec-5] o.n.ogm.session.request.RequestExecutor : to (maybe) create: relEntity -1054618601:461
2016-07-14 22:04:42.896 DEBUG 26162 --- [nio-8080-exec-5] o.n.ogm.session.request.RequestExecutor : to (maybe) create: relEntity -1648969869:462
2016-07-14 22:04:42.896 DEBUG 26162 --- [nio-8080-exec-5] o.n.ogm.session.request.RequestExecutor : to (maybe) create: relEntity -1950378672:463
2016-07-14 22:04:42.896 DEBUG 26162 --- [nio-8080-exec-5] o.n.ogm.session.request.RequestExecutor : to (maybe) create: relEntity -1646367736:464
2016-07-14 22:04:42.897 INFO 26162 --- [nio-8080-exec-5] o.n.o.drivers.http.request.HttpRequest : Thread 41: POST http://localhost:7474/db/data/transaction/531/commit HTTP/1.1
2016-07-14 22:04:42.908 DEBUG 26162 --- [nio-8080-exec-5] o.n.o.drivers.http.request.HttpRequest : Thread 41: HttpResponse HttpResponseProxy{HTTP/1.1 200 OK [Date: Thu, 14 Jul 2016 20:04:42 GMT, Content-Type: application/json, Access-Control-Allow-Origin: *, Content-Length: 26, Server: Jetty(9.2.9.v20150224)] ResponseEntityProxy{[Content-Type: application/json,Content-Length: 26,Chunked: false]}}
2016-07-14 22:04:42.909 DEBUG 26162 --- [nio-8080-exec-5] o.n.ogm.drivers.http.driver.HttpDriver : Thread 41: {"results":[],"errors":[]}
2016-07-14 22:04:42.909 DEBUG 26162 --- [nio-8080-exec-5] o.n.ogm.drivers.http.driver.HttpDriver : Thread 41: Connection released
2016-07-14 22:04:42.909 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.transaction.Transaction : Thread 41: Commit transaction extent: 0
2016-07-14 22:04:42.909 DEBUG 26162 --- [nio-8080-exec-5] org.neo4j.ogm.transaction.Transaction : Thread 41: Committed
2016-07-14 22:04:42.909 DEBUG 26162 --- [nio-8080-exec-5] o.n.ogm.session.request.RequestExecutor : creating new node id: 2109
2016-07-14 22:04:42.909 DEBUG 26162 --- [nio-8080-exec-5] c.m.myapp.aop.logging.LoggingAspect : Exit: com.mycompany.myapp.service.EventService.createEvent() with result = Event{id=2109, title='Event 47', shortDescription='Opis krotki short', longDescription='Opis długi long', address='address 5', lat=50.000452, lon=20.957071, time=Sun Jun 18 01:07:34 CEST 2017, nuts=17, createdBy='Michal Niedziela', createdDate=2016-07-14 22:04:42.863, modifiedBy='null', modifiedDate=null, deletedDate=1970-01-01 01:00:00.0, tagSet=[Tag{id=2100, tag='Rock'}, Tag{id=2098, tag='Festiwal'}, Tag{id=3231, tag='Plaża'}], joinedUsers=[], organizedUsers=[UserNeo{id=3153, firstName='Michal', lastName='Niedziela', email='sunday1601#gmail.com', vip=false, nuts=100, currentLat=50.028797, currentLon=21.000123, createdDate=Tue Jul 12 11:07:55 CEST 2016, deletedDate=null, joinEvents=null, organizeEvents=null}]}
2016-07-14 22:04:42.909 DEBUG 26162 --- [nio-8080-exec-5] c.m.myapp.aop.logging.LoggingAspect : Exit: com.mycompany.myapp.web.rest.EventResources.createEvent() with result = <200 OK,Event{id=2109, title='Event 47', shortDescription='Opis krotki short', longDescription='Opis długi long', address='address 5', lat=50.000452, lon=20.957071, time=Sun Jun 18 01:07:34 CEST 2017, nuts=17, createdBy='Michal Niedziela', createdDate=2016-07-14 22:04:42.863, modifiedBy='null', modifiedDate=null, deletedDate=1970-01-01 01:00:00.0, tagSet=[Tag{id=2100, tag='Rock'}, Tag{id=2098, tag='Festiwal'}, Tag{id=3231, tag='Plaża'}], joinedUsers=[], organizedUsers=[UserNeo{id=3153, firstName='Michal', lastName='Niedziela', email='sunday1601#gmail.com', vip=false, nuts=100, currentLat=50.028797, currentLon=21.000123, createdDate=Tue Jul 12 11:07:55 CEST 2016, deletedDate=null, joinEvents=null, organizeEvents=null}]},{}>
When you add tags to the event, it looks like the Tag does not contain a reference back to the Event? This could be one of the reasons the event-tag relationships are deleted i.e. your object references inconsistent with what is expected in the graph.
In case you want to define relationship in only one of the entities, you may use Session.clear after saving of tag so that tag is not tracked by session and does not get automatically saved after change to event.
https://docs.spring.io/spring-data/neo4j/docs/5.0.0.M1/reference/html/#reference.architecture.session