Spring Data JDBC Mapped Key Column
ID |
java.spring_data_jdbc_mapped_key_column |
Severity |
low |
Remediation Complexity |
trivial |
Remediation Risk |
low |
Remediation Effort |
low |
Resource |
Reliability |
Language |
Java |
Tags |
best-practice, spring |
Description
Reports @MappedCollection annotations on List or Map fields that do not specify a keyColumn attribute. Spring Data JDBC needs the key column to determine element ordering in lists and the map key mapping. Without it, the collection is loaded in an undefined order or fails entirely.
Rationale
Reliability — List elements may be loaded in random order, causing data corruption. Map fields fail to map keys correctly.