-
Notifications
You must be signed in to change notification settings - Fork 617
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Use direction as part of the node collection name for each relat…
…ionship. This avoids having duplicate keys in the map projection used to collect the nodes for each relationship in cases where a node has two relationships with the same name to the same label in different directions. Fixes #2918. Co-authored-by: Mathias Kühn <[email protected]>
- Loading branch information
1 parent
e8de22e
commit eca86bc
Showing
6 changed files
with
144 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/test/java/org/springframework/data/neo4j/integration/issues/gh2918/ConditionNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright 2011-2024 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.springframework.data.neo4j.integration.issues.gh2918; | ||
|
||
import java.util.Set; | ||
|
||
import org.springframework.data.neo4j.core.schema.GeneratedValue; | ||
import org.springframework.data.neo4j.core.schema.Id; | ||
import org.springframework.data.neo4j.core.schema.Node; | ||
import org.springframework.data.neo4j.core.schema.Relationship; | ||
import org.springframework.data.neo4j.core.support.UUIDStringGenerator; | ||
|
||
/** | ||
* @author Mathias Kühn | ||
*/ | ||
@Node | ||
public class ConditionNode { | ||
@Id | ||
@GeneratedValue(UUIDStringGenerator.class) | ||
public String uuid; | ||
|
||
@Relationship(type = "CAUSES", direction = Relationship.Direction.INCOMING) | ||
public Set<FailureRelationship> upstreamFailures; | ||
|
||
@Relationship(type = "CAUSES", direction = Relationship.Direction.OUTGOING) | ||
public Set<FailureRelationship> downstreamFailures; | ||
} |
24 changes: 24 additions & 0 deletions
24
...st/java/org/springframework/data/neo4j/integration/issues/gh2918/ConditionRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Copyright 2011-2024 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.springframework.data.neo4j.integration.issues.gh2918; | ||
|
||
import org.springframework.data.neo4j.repository.Neo4jRepository; | ||
|
||
/** | ||
* @author Mathias Kühn | ||
*/ | ||
public interface ConditionRepository extends Neo4jRepository<ConditionNode, String> { | ||
} |
31 changes: 31 additions & 0 deletions
31
src/test/java/org/springframework/data/neo4j/integration/issues/gh2918/FailureNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright 2011-2024 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.springframework.data.neo4j.integration.issues.gh2918; | ||
|
||
import org.springframework.data.neo4j.core.schema.GeneratedValue; | ||
import org.springframework.data.neo4j.core.schema.Id; | ||
import org.springframework.data.neo4j.core.schema.Node; | ||
import org.springframework.data.neo4j.core.support.UUIDStringGenerator; | ||
|
||
/** | ||
* @author Mathias Kühn | ||
*/ | ||
@Node | ||
public class FailureNode { | ||
@Id | ||
@GeneratedValue(UUIDStringGenerator.class) | ||
public String uuid; | ||
} |
33 changes: 33 additions & 0 deletions
33
...st/java/org/springframework/data/neo4j/integration/issues/gh2918/FailureRelationship.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright 2011-2024 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.springframework.data.neo4j.integration.issues.gh2918; | ||
|
||
import org.springframework.data.neo4j.core.schema.RelationshipId; | ||
import org.springframework.data.neo4j.core.schema.RelationshipProperties; | ||
import org.springframework.data.neo4j.core.schema.TargetNode; | ||
|
||
/** | ||
* @author Mathias Kühn | ||
*/ | ||
@RelationshipProperties | ||
public abstract class FailureRelationship { | ||
|
||
@RelationshipId | ||
public String id; | ||
|
||
@TargetNode | ||
public FailureNode target; | ||
} |