From c05bedce178fd03a023694b1b9040644fe666acc Mon Sep 17 00:00:00 2001 From: Oliver Gierke Date: Mon, 28 Mar 2011 20:31:55 +0200 Subject: [PATCH] Fixed bug in Property. --- .../data/repository/query/parser/Property.java | 4 ++-- .../data/repository/query/parser/PropertyUnitTests.java | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) 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 {