diff --git a/spring-data-commons-core/src/main/java/org/springframework/data/repository/query/parser/Property.java b/spring-data-commons-core/src/main/java/org/springframework/data/repository/query/parser/Property.java index df71ad597..afe1fafae 100644 --- a/spring-data-commons-core/src/main/java/org/springframework/data/repository/query/parser/Property.java +++ b/spring-data-commons-core/src/main/java/org/springframework/data/repository/query/parser/Property.java @@ -285,7 +285,7 @@ public class Property { IllegalArgumentException exception = null; try { - return new Property(source, type); + return new Property(source, type, addTail); } catch (IllegalArgumentException e) { exception = e; } @@ -299,7 +299,7 @@ public class Property { String head = source.substring(0, position); String tail = source.substring(position); - return new Property(head, type, tail + addTail); + return create(head, type, tail + addTail); } throw exception; diff --git a/spring-data-commons-core/src/test/java/org/springframework/data/repository/query/parser/PropertyUnitTests.java b/spring-data-commons-core/src/test/java/org/springframework/data/repository/query/parser/PropertyUnitTests.java index f1810ba52..f5426528a 100644 --- a/spring-data-commons-core/src/test/java/org/springframework/data/repository/query/parser/PropertyUnitTests.java +++ b/spring-data-commons-core/src/test/java/org/springframework/data/repository/query/parser/PropertyUnitTests.java @@ -123,6 +123,12 @@ public class PropertyUnitTests { Property.from("userMapMame", Bar.class); } + + @Test + public void findsNested() { + + Property from = Property.from("barUserName", Sample.class); + } private class Foo { @@ -146,6 +152,7 @@ public class PropertyUnitTests { private String userName; private FooBar user; + private Bar bar; } private class Sample2 {