DATAJDBC-331 Introduce @MappedCollection annotation.
We now provide a @MappedCollection annotation as replacement for @Column's keyColumn attribute.
class Person {
@MappedCollection(idColumn = "the_id", keyColumn = "the_key")
private List<Integer> mappedList;
}
Original pull request: #117.
This commit is contained in:
committed by
Mark Paluch
parent
1c0bd4fdb8
commit
6fcff3ea80
@@ -31,6 +31,7 @@ import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.mapping.PropertyHandler;
|
||||
import org.springframework.data.relational.core.mapping.BasicRelationalPersistentProperty;
|
||||
import org.springframework.data.relational.core.mapping.Column;
|
||||
import org.springframework.data.relational.core.mapping.MappedCollection;
|
||||
import org.springframework.data.relational.core.mapping.RelationalMappingContext;
|
||||
import org.springframework.data.relational.core.mapping.RelationalPersistentEntity;
|
||||
import org.springframework.data.relational.core.mapping.RelationalPersistentProperty;
|
||||
@@ -137,7 +138,7 @@ public class BasicJdbcPersistentPropertyUnitTests {
|
||||
private final List<String> listField;
|
||||
private final UUID uuid;
|
||||
|
||||
@Column(value = "dummy_column_name", keyColumn = "dummy_key_column_name") private List<Integer> someList;
|
||||
@MappedCollection(idColumn = "dummy_column_name", keyColumn = "dummy_key_column_name") private List<Integer> someList;
|
||||
|
||||
// DATACMNS-106
|
||||
private @Column("dummy_name") String name;
|
||||
|
||||
@@ -32,6 +32,7 @@ import org.springframework.data.jdbc.repository.support.JdbcRepositoryFactory;
|
||||
import org.springframework.data.jdbc.testing.TestConfiguration;
|
||||
import org.springframework.data.relational.core.mapping.Column;
|
||||
import org.springframework.data.relational.core.mapping.Embedded;
|
||||
import org.springframework.data.relational.core.mapping.MappedCollection;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
||||
@@ -254,7 +255,7 @@ public class JdbcRepositoryEmbeddedWithCollectionIntegrationTests {
|
||||
|
||||
@Data
|
||||
private static class Embeddable {
|
||||
@Column(value = "id", keyColumn = "order_key")
|
||||
@MappedCollection(idColumn = "id", keyColumn = "order_key")
|
||||
List<DummyEntity2> list = new ArrayList<>();
|
||||
|
||||
String test;
|
||||
|
||||
Reference in New Issue
Block a user