Skip to content

DATAES-989 - Improve deprecation warning for id properties without an… #563

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.slf4j.LoggerFactory;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.data.elasticsearch.annotations.GeoPointField;
Expand Down Expand Up @@ -83,9 +84,9 @@ public SimpleElasticsearchPersistentProperty(Property property,
// deprecated since 4.1
@Deprecated
boolean isIdWithoutAnnotation = isId && !isAnnotationPresent(Id.class);
if (isIdWithoutAnnotation) {
if (isIdWithoutAnnotation && owner.isAnnotationPresent(Document.class)) {
LOGGER.warn("Using the property name of '{}' to identify the id property is deprecated."
+ " Please annotate the id property with '@Id'", getName());
+ " Please annotate the id property with '@Id'", owner.getName() + "." + getName());
}

this.isScore = isAnnotationPresent(Score.class);
Expand Down