You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/main/antora/modules/ROOT/pages/jdbc/mapping.adoc
+10-7Lines changed: 10 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,19 +55,22 @@ The properties of the following types are currently supported:
55
55
* References to other entities.
56
56
They are considered a one-to-one relationship, or an embedded type.
57
57
It is optional for one-to-one relationship entities to have an `id` attribute.
58
-
The table of the referenced entity is expected to have an additional column with a name based on the referencing entity see xref:jdbc/entity-persistence.adoc#jdbc.entity-persistence.types.backrefs[Back References].
58
+
The table of the referenced entity is expected to have an additional column with a name based on the referencing entity see <<jdbc.entity-persistence.types.backrefs>>.
59
59
Embedded entities do not need an `id`.
60
-
If one is present it gets ignored.
60
+
If one is present it gets mapped as a normal attribute without any special meaning.
61
61
62
62
* `Set<some entity>` is considered a one-to-many relationship.
63
-
The table of the referenced entity is expected to have an additional column with a name based on the referencing entity see xref:jdbc/entity-persistence.adoc#jdbc.entity-persistence.types.backrefs[Back References].
63
+
The table of the referenced entity is expected to have an additional column with a name based on the referencing entity see <<jdbc.entity-persistence.types.backrefs>>.
64
64
65
65
* `Map<simple type, some entity>` is considered a qualified one-to-many relationship.
66
-
The table of the referenced entity is expected to have two additional columns: One named based on the referencing entity for the foreign key (see xref:jdbc/entity-persistence.adoc#jdbc.entity-persistence.types.backrefs[Back References]) and one with the same name and an additional `_key` suffix for the map key.
67
-
You can change this behavior by implementing `NamingStrategy.getReverseColumnName(PersistentPropertyPathExtension path)` and `NamingStrategy.getKeyColumn(RelationalPersistentProperty property)`, respectively.
68
-
Alternatively you may annotate the attribute with `@MappedCollection(idColumn="your_column_name", keyColumn="your_key_column_name")`
66
+
The table of the referenced entity is expected to have two additional columns: One named based on the referencing entity for the foreign key (see <<jdbc.entity-persistence.types.backrefs>>) and one with the same name and an additional `_key` suffix for the map key.
67
+
68
+
* `List<some entity>` is mapped as a `Map<Integer, some entity>`. The same additional columns are expected and the names used can be customized in the same way.
69
+
70
+
For `List`, `Set`, and `Map` naming of the back reference can be controlled by implementing `NamingStrategy.getReverseColumnName(PersistentPropertyPathExtension path)` and `NamingStrategy.getKeyColumn(RelationalPersistentProperty property)`, respectively.
71
+
Alternatively you may annotate the attribute with `@MappedCollection(idColumn="your_column_name", keyColumn="your_key_column_name")`.
72
+
Specifying a key column for a `Set` has no effect.
69
73
70
-
* `List<some entity>` is mapped as a `Map<Integer, some entity>`.
0 commit comments