Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
05-17-2021 09:10 AM
I'm struggling to migrate from old version to SDN6. This is my test:
@Test
public void testParentDecisionGroupsForDecision() {
User user = userDao.create("user1", "user1", "user1@test.com", null, null, 100L, null);
Decision parentDecision = decisionDao.create("parentDecision1", "parentDecision1", null, null, user);
DecisionGroup decisionGroup = decisionGroupDao.create("decisionGroup1", "decisionGroup1", parentDecision, OwnershipType.ANY, user);
Decision childDecision = decisionDao.create("childDecision", "childDecision", null, decisionGroup, user);
assertEquals(1, decisionGroupDao.findAllParentDecisionGroupsByDecisionId(childDecision.getId()).size());
}
It fails on the assertEquals statement - returns 0.
@Node
public class DecisionGroup extends BaseEntity {
private static final String CONTAINS_DECISION_GROUP = "CONTAINS_DECISION_GROUP";
private static final String CONTAINS = "CONTAINS";
....
@Relationship(type = CONTAINS_DECISION_GROUP, direction = Relationship.Direction.INCOMING)
private Set<OwnerDecision> ownerDecisions = new HashSet<>();
@Relationship(type = CONTAINS, direction = Relationship.Direction.OUTGOING)
private Set<Decision> childDecisions = new HashSet<>();
@Node
public class Decision extends BaseEntity {
private static final String CONTAINS = "CONTAINS";
...
@Relationship(type = CONTAINS, direction = Relationship.Direction.INCOMING)
private Set<DecisionGroup> parentGroups = new HashSet<>();
public Decision(String name, String description, String customId, DecisionGroup parentGroup, User author) {
setName(name);
this.description = description;
setCustomId(customId);
if (parentGroup != null) {
getParentGroups().add(parentGroup);
parentGroup.incrementTotalChildDecisions();
}
setCreateUser(author);
}
@Query("MATCH (dg:DecisionGroup)-[:CONTAINS]->(childD:Decision) WHERE childD.id = $decisionId RETURN dg")
List<DecisionGroup> findAllParentDecisionGroupsByDecisionId(@Param("decisionId") Long decisionId);
For some reason there is not relationship CONTAINS
between DecisionGroup and Decision nodes. What am I doing wrong and how to fix it? Thanks
05-18-2021 12:29 AM
Hard to guess what happens in the DAOs. Could you add a little bit more information about the internal logic how you persist the data? (or link an example)
All the sessions of the conference are now available online