diff --git a/pom.xml b/pom.xml index 241d12e5a..26e547a6f 100644 --- a/pom.xml +++ b/pom.xml @@ -53,7 +53,7 @@ 3.0.6.RELEASE - 1.2.0.M1 + 1.2.0.BUILD-SNAPSHOT 3.6.5.Final 2.1.0 2.2.0 diff --git a/src/main/java/org/springframework/data/jpa/repository/query/JpaQueryCreator.java b/src/main/java/org/springframework/data/jpa/repository/query/JpaQueryCreator.java index 323d64c93..df5d176f0 100644 --- a/src/main/java/org/springframework/data/jpa/repository/query/JpaQueryCreator.java +++ b/src/main/java/org/springframework/data/jpa/repository/query/JpaQueryCreator.java @@ -32,13 +32,13 @@ import javax.persistence.criteria.Predicate; import javax.persistence.criteria.Root; import org.springframework.data.domain.Sort; +import org.springframework.data.mapping.PropertyPath; import org.springframework.data.repository.query.Parameter; import org.springframework.data.repository.query.Parameters; import org.springframework.data.repository.query.parser.AbstractQueryCreator; import org.springframework.data.repository.query.parser.Part; import org.springframework.data.repository.query.parser.Part.Type; import org.springframework.data.repository.query.parser.PartTree; -import org.springframework.data.repository.query.parser.Property; import org.springframework.util.Assert; import org.springframework.util.ClassUtils; @@ -296,7 +296,7 @@ public class JpaQueryCreator extends AbstractQueryCreator, */ public Predicate build() { - Property property = part.getProperty(); + PropertyPath property = part.getProperty(); Expression path = toExpressionRecursively(root, property); switch (part.getType()) { @@ -343,7 +343,7 @@ public class JpaQueryCreator extends AbstractQueryCreator, switch (part.shouldIgnoreCase()) { case ALWAYS: Assert.state(canUpperCase(expression), "Unable to ignore case of " + expression.getJavaType().getName() - + " types, the property '" + part.getProperty().getName() + "' must reference a String"); + + " types, the property '" + part.getProperty().getSegment() + "' must reference a String"); return (Expression) builder.upper((Expression) expression); case WHEN_POSSIBLE: if (canUpperCase(expression)) { diff --git a/src/main/java/org/springframework/data/jpa/repository/query/QueryUtils.java b/src/main/java/org/springframework/data/jpa/repository/query/QueryUtils.java index 53653220e..f53d5604e 100644 --- a/src/main/java/org/springframework/data/jpa/repository/query/QueryUtils.java +++ b/src/main/java/org/springframework/data/jpa/repository/query/QueryUtils.java @@ -36,7 +36,7 @@ import javax.persistence.criteria.Root; import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort.Order; -import org.springframework.data.repository.query.parser.Property; +import org.springframework.data.mapping.PropertyPath; import org.springframework.util.Assert; /** @@ -280,25 +280,25 @@ public abstract class QueryUtils { */ private static javax.persistence.criteria.Order toJpaOrder(Order order, Root root, CriteriaBuilder cb) { - Expression expression = toExpressionRecursively(root, Property.from(order.getProperty(), root.getJavaType())); + Expression expression = toExpressionRecursively(root, PropertyPath.from(order.getProperty(), root.getJavaType())); return order.isAscending() ? cb.asc(expression) : cb.desc(expression); } @SuppressWarnings("unchecked") - static Expression toExpressionRecursively(From from, Property property) { + static Expression toExpressionRecursively(From from, PropertyPath property) { if (property.isCollection()) { - Join join = from.join(property.getName()); + Join join = from.join(property.getSegment()); return (Expression) (property.hasNext() ? toExpressionRecursively((From) join, property.next()) : join); } else { - Path path = from.get(property.getName()); + Path path = from.get(property.getSegment()); return (Expression) (property.hasNext() ? toExpressionRecursively(path, property.next()) : path); } } - static Expression toExpressionRecursively(Path path, Property property) { + static Expression toExpressionRecursively(Path path, PropertyPath property) { - Path result = path.get(property.getName()); + Path result = path.get(property.getSegment()); return property.hasNext() ? toExpressionRecursively(result, property.next()) : result; } }