diff --git a/pom.xml b/pom.xml
index 548a846177..06b7ae0cf5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
org.springframework.data
spring-data-mongodb-parent
- 3.3.0-SNAPSHOT
+ 3.3.0.DATAMONGO-2250-SNAPSHOT
pom
Spring Data MongoDB
@@ -26,7 +26,7 @@
multi
spring-data-mongodb
- 2.6.0-SNAPSHOT
+ 2.6.0.DATACMNS-1509-SNAPSHOT
4.2.3
${mongo}
1.19
diff --git a/spring-data-mongodb-benchmarks/pom.xml b/spring-data-mongodb-benchmarks/pom.xml
index 0033bd11d5..2cdd2d376e 100644
--- a/spring-data-mongodb-benchmarks/pom.xml
+++ b/spring-data-mongodb-benchmarks/pom.xml
@@ -7,7 +7,7 @@
org.springframework.data
spring-data-mongodb-parent
- 3.3.0-SNAPSHOT
+ 3.3.0.DATAMONGO-2250-SNAPSHOT
../pom.xml
diff --git a/spring-data-mongodb-distribution/pom.xml b/spring-data-mongodb-distribution/pom.xml
index f62c8dc7f4..562be3249c 100644
--- a/spring-data-mongodb-distribution/pom.xml
+++ b/spring-data-mongodb-distribution/pom.xml
@@ -14,7 +14,7 @@
org.springframework.data
spring-data-mongodb-parent
- 3.3.0-SNAPSHOT
+ 3.3.0.DATAMONGO-2250-SNAPSHOT
../pom.xml
diff --git a/spring-data-mongodb/pom.xml b/spring-data-mongodb/pom.xml
index c1efaea420..c0eb24d741 100644
--- a/spring-data-mongodb/pom.xml
+++ b/spring-data-mongodb/pom.xml
@@ -11,7 +11,7 @@
org.springframework.data
spring-data-mongodb-parent
- 3.3.0-SNAPSHOT
+ 3.3.0.DATAMONGO-2250-SNAPSHOT
../pom.xml
diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/mapping/BasicMongoPersistentEntity.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/mapping/BasicMongoPersistentEntity.java
index 7bf8214aeb..0a555a7aa8 100644
--- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/mapping/BasicMongoPersistentEntity.java
+++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/mapping/BasicMongoPersistentEntity.java
@@ -353,7 +353,7 @@ private void assertUniqueness(MongoPersistentProperty property) {
if (existingProperty != null) {
throw new MappingException(
- String.format(AMBIGUOUS_FIELD_MAPPING, property.toString(), existingProperty.toString(), fieldName));
+ String.format(AMBIGUOUS_FIELD_MAPPING, property, existingProperty, fieldName));
}
properties.put(fieldName, property);
diff --git a/spring-data-mongodb/src/test/kotlin/org/springframework/data/mongodb/core/OverridePropertyClasses.kt b/spring-data-mongodb/src/test/kotlin/org/springframework/data/mongodb/core/OverridePropertyClasses.kt
new file mode 100644
index 0000000000..824fb5131d
--- /dev/null
+++ b/spring-data-mongodb/src/test/kotlin/org/springframework/data/mongodb/core/OverridePropertyClasses.kt
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2019 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.data.mongodb.core
+
+import com.mongodb.client.MongoClients
+import org.junit.Test
+import org.springframework.data.mongodb.core.mapping.Field
+import org.springframework.data.mongodb.repository.MongoRepository
+import org.springframework.data.mongodb.repository.support.MongoRepositoryFactory
+import org.springframework.data.mongodb.test.util.Assertions.assertThat
+
+open class SuperType(open var field: Int)
+
+class SubType(val id: String, @Field("foo") override var field: Int = 1) :
+ SuperType(field) {
+
+ fun setFields(v: Int) {
+ field = v
+ super.field = v
+ }
+}
+
+interface MyRepository : MongoRepository
+
+class `KotlinOverridePropertyTests` {
+
+ val template = MongoTemplate(MongoClients.create(), "kotlin-tests")
+
+ @Test // DATAMONGO-2250
+ fun `Ambiguous field mapping for override val field`() {
+
+ val repository =
+ MongoRepositoryFactory(template).getRepository(MyRepository::class.java)
+
+ var subType = SubType("id-1")
+ subType.setFields(3)
+
+ repository.save(subType)
+
+ assertThat(repository.findById(subType.id).get().field).isEqualTo(subType.field)
+ }
+}