I created some entities and tried to save them to the database. Some of them saved, some of them didn't. But no errors were thrown. I'm going to try to put together an example.
The Person
GOES_TO
a Place
. A Thing
is OWNED_BY
a Person
. I get a collection of people, and call saveAll(people)
and the Places are in the DB, but the People are not. Then I get a collection of Things from each person and the Things are saved in the DB, but still no People.
Here are some classes:
NodeEntity //put an @ here (new user limitation)
public class Person {
Id // put an @ here
private Long id;
private String name;
Relationship(type = "GOES_TO") // put an @ here
private Place place;
// ... getters and setters here
}
NodeEntity // put an @ here
public class Place {
Id // put an @ here
private Long id;
private String name;
Relationship(type = "IN") // put an @ here
private Country country; // note that this value is always null in this test
// ... getters and setters here
}
NodeEntity // put an @ here
public class Thing {
Id // put an @ here
private String thingId; // note the ID is different, not sure if that matters
private String name;
Relationship(type = "OWNED_BY") // put an @ here
private Person person;
// ... getters and setters here
}
Pretty simple right? I create standard Spring repositories for each entity like this:
public interface PersonRepository extends Neo4jRepository<Person, Long> {
}
Then I go to save some Person
objects. With a collection of Person
s, I see that the Place
s that they have inside them are being created in the database, but the Person
s are not. Then, I create a bunch of Thing
s, attaching the relevant Person
to them. This time the Thing
s are created, but still no Person
s are created. No error is being thrown, there just aren't any nodes.
P.S. this is a minimal example. I'm not 100% sure yet if it reproduces the error, but I'll work on an example of that. and update this post.