diff --git a/pom.xml b/pom.xml
index 02461b8e40..a0f8c4e752 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
org.springframework.data
spring-data-relational-parent
- 3.3.0-SNAPSHOT
+ 3.3.0-1692-collection-in-embedded-SNAPSHOT
pom
Spring Data Relational Parent
diff --git a/spring-data-jdbc-distribution/pom.xml b/spring-data-jdbc-distribution/pom.xml
index 8d987fb028..51c65d5073 100644
--- a/spring-data-jdbc-distribution/pom.xml
+++ b/spring-data-jdbc-distribution/pom.xml
@@ -14,7 +14,7 @@
org.springframework.data
spring-data-relational-parent
- 3.3.0-SNAPSHOT
+ 3.3.0-1692-collection-in-embedded-SNAPSHOT
../pom.xml
diff --git a/spring-data-jdbc/pom.xml b/spring-data-jdbc/pom.xml
index fddbaab696..c57532d107 100644
--- a/spring-data-jdbc/pom.xml
+++ b/spring-data-jdbc/pom.xml
@@ -6,7 +6,7 @@
4.0.0
spring-data-jdbc
- 3.3.0-SNAPSHOT
+ 3.3.0-1692-collection-in-embedded-SNAPSHOT
Spring Data JDBC
Spring Data module for JDBC repositories.
@@ -15,7 +15,7 @@
org.springframework.data
spring-data-relational-parent
- 3.3.0-SNAPSHOT
+ 3.3.0-1692-collection-in-embedded-SNAPSHOT
diff --git a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/MappingJdbcConverter.java b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/MappingJdbcConverter.java
index a4cb8e08ad..746fd3664e 100644
--- a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/MappingJdbcConverter.java
+++ b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/MappingJdbcConverter.java
@@ -26,7 +26,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
import org.springframework.context.ApplicationContextAware;
import org.springframework.core.convert.ConverterNotFoundException;
import org.springframework.core.convert.converter.Converter;
@@ -45,6 +44,7 @@
import org.springframework.data.relational.core.mapping.RelationalMappingContext;
import org.springframework.data.relational.core.mapping.RelationalPersistentEntity;
import org.springframework.data.relational.core.mapping.RelationalPersistentProperty;
+import org.springframework.data.relational.core.sql.SqlIdentifier;
import org.springframework.data.relational.domain.RowDocument;
import org.springframework.data.util.TypeInformation;
import org.springframework.lang.Nullable;
@@ -366,15 +366,19 @@ public T getPropertyValue(RelationalPersistentProperty property) {
if (property.isCollectionLike() || property.isMap()) {
Identifier identifierToUse = this.identifier;
+ AggregatePath idDefiningParentPath = aggregatePath.getIdDefiningParentPath();
+
+ // note that the idDefiningParentPath might not itself have an id property, but have a combination of back
+ // references and possibly keys, that form an id
+ if (idDefiningParentPath.hasIdProperty()) {
- if (property.getOwner().hasIdProperty()) {
+ Class> idType = idDefiningParentPath.getRequiredIdProperty().getActualType();
+ SqlIdentifier parentId = idDefiningParentPath.getTableInfo().idColumnName();
+ Object idValue = this.identifier.get(parentId);
- Object id = this.identifier.get(property.getOwner().getRequiredIdProperty().getColumnName());
+ Assert.state(idValue != null, "idValue must not be null at this point");
- if (id != null) {
- identifierToUse = Identifier.of(aggregatePath.getTableInfo().reverseColumnInfo().name(), id,
- Object.class);
- }
+ identifierToUse = Identifier.of(aggregatePath.getTableInfo().reverseColumnInfo().name(), idValue, idType);
}
Iterable