Browse Source

DATAMONGO-2542 - Shortcut PersistentPropertyPath resolution during query mapping.

By shortcutting the path resolution we avoid checking keywords like $in against a potential path expression.

Original pull request: #863.
pull/868/head
Christoph Strobl 6 years ago committed by Mark Paluch
parent
commit
84ac0e8a85
No known key found for this signature in database
GPG Key ID: 51A00FA751B91849
  1. 10
      spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/QueryMapper.java

10
spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/QueryMapper.java

@ -965,7 +965,7 @@ public class QueryMapper { @@ -965,7 +965,7 @@ public class QueryMapper {
this.entity = entity;
this.mappingContext = context;
this.path = getPath(removePlaceholders(POSITIONAL_PARAMETER_PATTERN, name));
this.path = getPath(removePlaceholders(POSITIONAL_PARAMETER_PATTERN, name), property);
this.property = path == null ? property : path.getLeafProperty();
this.association = findAssociation();
}
@ -1079,11 +1079,17 @@ public class QueryMapper { @@ -1079,11 +1079,17 @@ public class QueryMapper {
* @return
*/
@Nullable
private PersistentPropertyPath<MongoPersistentProperty> getPath(String pathExpression) {
private PersistentPropertyPath<MongoPersistentProperty> getPath(String pathExpression,
MongoPersistentProperty sourceProperty) {
String rawPath = removePlaceholders(POSITIONAL_OPERATOR,
removePlaceholders(DOT_POSITIONAL_PATTERN, pathExpression));
if (sourceProperty != null && sourceProperty.getOwner().equals(entity)) {
return mappingContext
.getPersistentPropertyPath(PropertyPath.from(sourceProperty.getName(), entity.getTypeInformation()));
}
PropertyPath path = forName(rawPath);
if (path == null || isPathToJavaLangClassProperty(path)) {
return null;

Loading…
Cancel
Save