Skip to content

Commit 8d9b557

Browse files
committed
GH-2884 - Fix test case.
or at least make it pass :)
1 parent 7813c8a commit 8d9b557

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/main/java/org/springframework/data/neo4j/repository/query/CypherAdapterUtils.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,11 @@ public static Function<Sort.Order, SortItem> sortAdapterFor(NodeDescription<?> n
9696
} else if (graphProperty.isComposite() && !domainProperty.contains(".")) {
9797
throw new IllegalStateException(String.format("Cannot order by composite property: '%s'. Only ordering by its nested fields is allowed.", domainProperty));
9898
} else if (graphProperty.isComposite()) {
99-
expression = property(root, Constants.NAME_OF_ALL_PROPERTIES, domainProperty);
99+
if (nodeDescription.containsPossibleCircles(rpp -> true)) {
100+
expression = property(root, domainProperty);
101+
} else {
102+
expression = property(root, Constants.NAME_OF_ALL_PROPERTIES, domainProperty);
103+
}
100104
} else {
101105
expression = property(root, graphProperty.getPropertyName());
102106
if (order.isIgnoreCase()) {

src/test/java/org/springframework/data/neo4j/repository/query/CypherAdapterUtilsTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ void sortByCompositePropertyField() {
7373
var node = Cypher.anyNode("scrollingEntity");
7474
var statement = Cypher.match(node).returning(node).orderBy(sortItem).build();
7575
assertThat(Renderer.getDefaultRenderer().render(statement))
76-
.isEqualTo("MATCH (scrollingEntity) RETURN scrollingEntity ORDER BY scrollingEntity.`basicComposite.blubb`");
76+
.isEqualTo("MATCH (scrollingEntity) RETURN scrollingEntity ORDER BY scrollingEntity.__allProperties__.`basicComposite.blubb`");
7777
}
7878

7979
@Test

0 commit comments

Comments
 (0)