Skip to content

Commit 8e59b18

Browse files
authored
DATAES-989 - Improve deprecation warning for id properties without annotation.
Original PR: #563
1 parent c66443a commit 8e59b18

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main/java/org/springframework/data/elasticsearch/core/mapping/SimpleElasticsearchPersistentProperty.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.slf4j.LoggerFactory;
2525
import org.springframework.data.annotation.Id;
2626
import org.springframework.data.elasticsearch.annotations.DateFormat;
27+
import org.springframework.data.elasticsearch.annotations.Document;
2728
import org.springframework.data.elasticsearch.annotations.Field;
2829
import org.springframework.data.elasticsearch.annotations.FieldType;
2930
import org.springframework.data.elasticsearch.annotations.GeoPointField;
@@ -83,9 +84,9 @@ public SimpleElasticsearchPersistentProperty(Property property,
8384
// deprecated since 4.1
8485
@Deprecated
8586
boolean isIdWithoutAnnotation = isId && !isAnnotationPresent(Id.class);
86-
if (isIdWithoutAnnotation) {
87+
if (isIdWithoutAnnotation && owner.isAnnotationPresent(Document.class)) {
8788
LOGGER.warn("Using the property name of '{}' to identify the id property is deprecated."
88-
+ " Please annotate the id property with '@Id'", getName());
89+
+ " Please annotate the id property with '@Id'", owner.getName() + "." + getName());
8990
}
9091

9192
this.isScore = isAnnotationPresent(Score.class);

0 commit comments

Comments
 (0)