spring-projects / spring-projects/spring-data-relational
Cannot obtain ColumnInfo for embedded path
Open
@schauder is already working on this.
Since Dec 17, 2025.
status: feedback-provided
status: waiting-for-triage
- Dominant language
- Java
- Stars
- 827
- Forks
- 394
- PR merge metrics
- No merged PRs in 30d
Description
spring-data-jdbc 4.0.0
A composite primary key exception
@Data
@Table("tenant_user")
public class TenantUser {
@Id
private TenantUserID id;
private String alias;
}
public record TenantUserID(String uid, String tid) {
}
Then run:
tenantUserRepository.findById(new TenantUserID("1", "2"))
Stack Trace:
java.lang.IllegalArgumentException: Cannot obtain ColumnInfo for embedded path
at org.springframework.util.Assert.isTrue(Assert.java:136)
at org.springframework.data.relational.core.mapping.AggregatePath$ColumnInfo.of(AggregatePath.java:502)
at org.springframework.data.relational.core.mapping.DefaultAggregatePath.lambda$new$1(DefaultAggregatePath.java:47)
at org.springframework.data.util.Lazy.getNullable(Lazy.java:136)
at org.springframework.data.util.Lazy.get(Lazy.java:114)
at org.springframework.data.relational.core.mapping.DefaultAggregatePath.getColumnInfo(DefaultAggregatePath.java:326)
at org.springframework.data.relational.core.conversion.MappingRelationalConverter$DocumentValueProvider.getValue(MappingRelationalConverter.java:1229)
at org.springframework.data.jdbc.core.convert.MappingJdbcConverter$ResolvingRelationalPropertyValueProvider.lambda$new$0(MappingJdbcConverter.java:409)
at org.springframework.data.jdbc.core.convert.MappingJdbcConverter$ResolvingRelationalPropertyValueProvider.potentiallyAppendIdentifier(MappingJdbcConverter.java:422)
at org.springframework.data.jdbc.core.convert.MappingJdbcConverter$ResolvingRelationalPropertyValueProvider.<init>(MappingJdbcConverter.java:408)
at org.springframework.data.jdbc.core.convert.MappingJdbcConverter.newValueProvider(MappingJdbcConverter.java:364)
at org.springframework.data.relational.core.conversion.MappingRelationalConverter.populateProperties(MappingRelationalConverter.java:548)
When change class 'TenantUser' to reocrd type
@Table("tenant_user")
public record TenantUser(
@Id TenantUserID id,
String alias) {
}
The method 'findById' is work!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.