Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public privileged aspect Neo4jNodeBacking { // extends AbstractTypeAnnotatingMix
}

public Relationship NodeBacked.getRelationshipTo(NodeBacked target, String type) {
return template().getRelationshipBetween(this, target, null, type);
return template().getRelationshipBetween(this, target, type);
}

public Long NodeBacked.getNodeId() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,15 @@ public void testGetRelationshipToReturnsRelationship() {
assertEquals(f, neo4jTemplate.getRelationshipBetween(p, p2, Friendship.class, "knows"));
}

@Ignore("The NodeBacking.getRelationshipTo() method is broken at the moment")
@Test
@Transactional
public void testGetRelationshipTo() {
Person p = persistedPerson("Michael", 35);
Person p2 = persistedPerson("David", 25);
Friendship f = p.knows(p2);
assertNotNull(p.getRelationshipTo(p2, "knows"));
Relationship frel = p.getRelationshipTo(p2, "knows");
assertNotNull(frel);
assertEquals(f.getPersistentState().getId(), frel.getId());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,12 @@ public Object query(String statement, Map<String, Object> params, final TypeInfo
return infrastructure.getCypherQueryExecutor().queryForObject(statement, targetType, params);
}

@Override
public Relationship getRelationshipBetween(Object start, Object end, String relationshipType) {
notNull(start, "start", end, "end", relationshipType, "relationshipType");
return infrastructure.getEntityStateHandler().getRelationshipTo(start, end, relationshipType);
}

@Override
public <R> R getRelationshipBetween(Object start, Object end, Class<R> relationshipEntityClass, String relationshipType) {
notNull(start,"start",end,"end",relationshipEntityClass,"relationshipEntityClass",relationshipType,"relationshipType");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ public interface Neo4jOperations {

<R> R getRelationshipBetween(Object start, Object end, Class<R> relationshipEntityClass, String relationshipType);

Relationship getRelationshipBetween(Object start, Object end, String relationshipType);

void removeRelationshipBetween(Object start, Object end, String type);

<R> R createRelationshipBetween(Object start, Object end, Class<R> relationshipEntityClass, String relationshipType, boolean allowDuplicates);
Expand Down