Skip to content

Commit

Permalink
Map single-ended INCOMING one-to-one or one-to-many relationships
Browse files Browse the repository at this point in the history
Relationships were not added to mapping context, which consequently
caused the relationship not to be deleted. Fixes #357.
  • Loading branch information
frant-hartm committed May 2, 2017
1 parent 57acea3 commit 614e283
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,9 @@ private void mapOneToMany(Collection<Edge> oneToManyRelationships) {
Object source = mappingContext.getNodeEntity(edge.getStartNode());
Object target = mappingContext.getNodeEntity(edge.getEndNode());
FieldInfo writer = getRelationalWriter(metadata.classInfo(source), edge.getType(), OUTGOING, target);
if (writer == null) {
writer = getRelationalWriter(metadata.classInfo(target), edge.getType(), INCOMING, source);
}
// ensures its tracked in the domain
if (writer != null) {
MappedRelationship mappedRelationship = new MappedRelationship(edge.getStartNode(), edge.getType(), edge.getEndNode(), edge.getId(), source.getClass(), ClassUtils.getType(writer.typeParameterDescriptor()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,6 @@ public void shouldDeleteChangedIncomingRelationship() throws Exception {


@Test
@Ignore("Relationship is not deleted to the deep dish pizza.")
public void shouldDeleteChangedIncomingRelationshipWithClearSessionAndLoad() throws Exception {

Pizza pizza = new Pizza();
Expand Down

0 comments on commit 614e283

Please sign in to comment.