Skip to content

Commit 32f997e

Browse files
orange-buffaloschauder
authored andcommitted
DATAJDBC-520 - Improved documentation for MappedCollection annotation.
Original pull request: #206.
1 parent eb9e346 commit 32f997e

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

spring-data-relational/src/main/java/org/springframework/data/relational/core/mapping/MappedCollection.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@
2222
import java.lang.annotation.Target;
2323
import java.util.List;
2424
import java.util.Map;
25+
import java.util.Set;
2526

2627
/**
27-
* The annotation to configure the mapping for a {@link List} or {@link Map} property in the database.
28+
* The annotation to configure the mapping for a {@link List}, {@link Set} or {@link Map} property in the database.
2829
*
2930
* @since 1.1
3031
* @author Bastian Wilhelm

src/main/asciidoc/jdbc.adoc

+5-6
Original file line numberDiff line numberDiff line change
@@ -271,10 +271,9 @@ public class MyEntity {
271271
----
272272
====
273273

274-
The {javadoc-base}org/springframework/data/relational/core/mapping/MappedCollection.html[`@MappedCollection`] annotation can be used on a reference type (one-to-one relationship) or on Sets, Lists, and Maps (one-to-many relationship)
275-
On all these types the `value` element of the annotation is used to provide a custom name for the foreign key column referencing the id column in the other table.
276-
In the following example the corresponding table for the `MySubEntity` class has a name column, and the id column of the `MyEntity` id for relationship reasons.
277-
The name of this `MySubEntity` class's id column can also be customized with the `idColumn` element of the {javadoc-base}org/springframework/data/relational/core/mapping/MappedCollection.html[`@MappedCollection`] annotation:
274+
The {javadoc-base}org/springframework/data/relational/core/mapping/MappedCollection.html[`@MappedCollection`] annotation can be used on Sets, Lists, and Maps.
275+
`idColumn` element of the annotation provides a custom name for the foreign key column referencing the id column in the other table.
276+
In the following example the corresponding table for the `MySubEntity` class has a `NAME` column, and the `CUSTOM_MY_ENTITY_ID_COLUMN_NAME` column of the `MyEntity` id for relationship reasons:
278277

279278
====
280279
[source, java]
@@ -283,8 +282,8 @@ public class MyEntity {
283282
@Id
284283
Integer id;
285284
286-
@MappedCollection(idColumn = "CUSTOM_COLUMN_NAME")
287-
Set<MySubEntity> name;
285+
@MappedCollection(idColumn = "CUSTOM_MY_ENTITY_ID_COLUMN_NAME")
286+
Set<MySubEntity> subEntities;
288287
}
289288
290289
public class MySubEntity {

0 commit comments

Comments
 (0)