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
* The short Java class name is mapped to the table name in the following manner.
20
-
The class `com.bigbank.SavingsAccount` maps to the `SAVINGS_ACCOUNT` table name.
20
+
The `com.bigbank.SavingsAccount` class maps to the `SAVINGS_ACCOUNT` table name.
21
21
The same name mapping is applied for mapping fields to column names.
22
-
For example a field `firstName` will be mapped to a column `FIRST_NAME`
23
-
You can control this mapping by providing a custom `NamingStrategy`. See <<mapping.configuration>> for more details.
22
+
For example, the `firstName` field maps to the `FIRST_NAME` column.
23
+
You can control this mapping by providing a custom `NamingStrategy`. See <<mapping.configuration>> for more detail.
24
24
Table and column names that are derived from property or class names are used in SQL statements without quotes by default.
25
-
This behaviour can be controlled by setting `R2dbcMappingContext.setForceQuote(true)`.
25
+
You can control this behavior by setting `R2dbcMappingContext.setForceQuote(true)`.
26
26
27
27
* Nested objects are not supported.
28
28
@@ -44,14 +44,14 @@ By creating your own instance, you can register Spring converters to map specifi
44
44
45
45
You can configure the `MappingR2dbcConverter` as well as `DatabaseClient` and `ConnectionFactory` by using Java-based metadata. The following example uses Spring's Java-based configuration:
46
46
47
-
If you set `setForceQuote` of the `R2dbcMappingContext to `true` table and column names derived from classes and properties will be used with database specific quotes.
48
-
This means it is ok to use reserved SQL words like for example `order` in these names.
49
-
This can be done by overriding `r2dbcMappingContext(Optional<NamingStrategy>)` of `AbstractR2dbcConfiguration`.
47
+
If you set `setForceQuote` of the `R2dbcMappingContext to` true, table and column names derived from classes and properties are used with database specific quotes.
48
+
This means that it is OK to use reserved SQL words (such as order) in these names.
49
+
You can do so by overriding `r2dbcMappingContext(Optional<NamingStrategy>)` of `AbstractR2dbcConfiguration`.
50
50
Spring Data converts the letter casing of such a name to that form which is also used by the configured database when no quoting is used.
51
-
Therefore, you can use unquoted names when creating tables, as long as you don't use keywords or special characters in your names.
52
-
For databases adhering to the SQL standard with that respect this means, names will be converted to upper case.
53
-
The quoting character used, and the way names get capitalized is controlled by the used `Dialect`.
54
-
See <<r2dbc.drivers>> for details how to configure custom dialects.
51
+
Therefore, you can use unquoted names when creating tables, as long as you do not use keywords or special characters in your names.
52
+
For databases that adhere to the SQL standard, this means that names are converted to upper case.
53
+
The quoting character and the way names get capitalized is controlled by the used `Dialect`.
54
+
See <<r2dbc.drivers>> for how to configure custom dialects.
55
55
56
56
.@Configuration class to configure R2DBC mapping support
57
57
====
@@ -82,7 +82,7 @@ public class MyAppConfig extends AbstractR2dbcConfiguration {
82
82
83
83
You can add additional converters to the converter by overriding the `r2dbcCustomConversions` method.
84
84
85
-
You may configure a custom `NamingStrategy` by registering it as a bean.
85
+
You can configure a custom `NamingStrategy` by registering it as a bean.
86
86
The `NamingStrategy` controls how the names of classes and properties get converted to the names of tables and columns.
87
87
88
88
NOTE: `AbstractR2dbcConfiguration` creates a `DatabaseClient` instance and registers it with the container under the name of `databaseClient`.
@@ -161,7 +161,7 @@ The following table explains how property types of an entity affect mapping:
161
161
162
162
|Driver-specific types
163
163
|Passthru
164
-
|Contributed as simple type by the used `R2dbcDialect`.
164
+
|Contributed as a simple type by the used `R2dbcDialect`.
165
165
166
166
|Complex objects
167
167
|Target type depends on registered `Converter`.
@@ -190,9 +190,11 @@ Constructor arguments are mapped by name to the values in the retrieved row.
190
190
Within the mapping framework it can be applied to constructor arguments.
191
191
This lets you use a Spring Expression Language statement to transform a key’s value retrieved in the database before it is used to construct a domain object.
192
192
In order to reference a column of a given row one has to use expressions like: `@Value("#root.myProperty")` where root refers to the root of the given `Row`.
193
-
* `@Column`: Applied at the field level to describe the name of the column as it is represented in the row, allowing the name to be different from the field name of the class.
193
+
* `@Column`: Applied at the field level to describe the name of the column as it is represented in the row, letting the name be different from the field name of the class.
194
194
Names specified with a `@Column` annotation are always quoted when used in SQL statements.
195
-
For most databases this means these names are case-sensitive. It also means you may use special characters in these names, although this is not recommended since it may cause problems with other tools.
195
+
For most databases, this means that these names are case-sensitive.
196
+
It also means that you can use special characters in these names.
197
+
However, this is not recommended, since it may cause problems with other tools.
196
198
* `@Version`: Applied at field level is used for optimistic locking and checked for modification on save operations.
197
199
The value is `null` (`zero` for primitive types) is considered as marker for entities to be new.
198
200
The initially stored value is `zero` (`one` for primitive types).
The annotated query uses native bind markers, which are Postgres bind markers in this example.
119
119
====
120
120
121
-
Note that the columns of a select used in a `@Query` annotation must match the names generated by the `NamingStrategy` for the respective property.
122
-
If for a property no matching column is provided in a select, that property is not set. If that property is required by the persistence constructor, `null` is provided as a value or the default value for primitive types.
121
+
Note that the columns of a select statement used in a `@Query` annotation must match the names generated by the `NamingStrategy` for the respective property.
122
+
If a select statement does not include a matching column, that property is not set. If that property is required by the persistence constructor, either null or (for primitive types) the default value is provided.
123
123
124
124
The following table shows the keywords that are supported for query methods:
0 commit comments