Skip to content

Commit e9f297d

Browse files
author
Nathan Xu
committed
cosmetic doc improvements for jdbc components
1 parent f3256b2 commit e9f297d

File tree

11 files changed

+36
-36
lines changed

11 files changed

+36
-36
lines changed

src/main/antora/modules/ROOT/pages/jdbc/entity-persistence.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ See also xref:repositories/core-concepts.adoc#is-new-state-detection[Entity Stat
2121
Spring Data JDBC offers two ways how it can load aggregates:
2222

2323
. The traditional and before version 3.2 the only way is really simple:
24-
Each query loads the aggregate roots, independently if the query is based on a `CrudRepository` method, a derived query or a annotated query.
24+
Each query loads the aggregate roots, independently if the query is based on a `CrudRepository` method, a derived query or an annotated query.
2525
If the aggregate root references other entities those are loaded with separate statements.
2626

2727
. Spring Data JDBC 3.2 allows the use of _Single Query Loading_.
@@ -36,13 +36,13 @@ The plan is to remove this constraint in the future.
3636
2. The aggregate must not use `AggregateReference` or embedded entities.
3737
The plan is to remove this constraint in the future.
3838

39-
3. The database dialect must support it.Of the dialects provided by Spring Data JDBC all but H2 and HSQL support this.
39+
3. The database dialect must support it. Of the dialects provided by Spring Data JDBC all but H2 and HSQL support this.
4040
H2 and HSQL don't support analytic functions (aka windowing functions).
4141

4242
4. It only works for the find methods in `CrudRepository`, not for derived queries and not for annotated queries.
4343
The plan is to remove this constraint in the future.
4444

45-
5. Single Query Loading needs to be enabled in the `JdbcMappingContext`, by calling `setSingleQueryLoadingEnabled(true)`
45+
5. Single Query Loading needs to be enabled in the `JdbcMappingContext`, by calling `setSingleQueryLoadingEnabled(true)`.
4646

4747
If any condition is not fulfilled Spring Data JDBC falls back to the default approach of loading aggregates.
4848

@@ -77,7 +77,7 @@ Operating on single aggregates, named exactly as mentioned above, and with an `A
7777

7878
`save` does the same as the method of same name in a repository.
7979

80-
`insert` and `update` skip the test if the entity is new and assume a new or existing aggregate as indicated by their name.
80+
`insert` and `update` skip the test if the entity is new and assume a new or existing aggregate as indicated by their names.
8181

8282
=== Querying
8383

src/main/antora/modules/ROOT/pages/jdbc/events.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class PersonLoadListener extends AbstractRelationalEventListener<Person> {
4040
}
4141
----
4242

43-
The following table describes the available events.For more details about the exact relation between process steps see the link:#jdbc.entity-callbacks[description of available callbacks] which map 1:1 to events.
43+
The following table describes the available events. For more details about the exact relation between process steps see the link:#jdbc.entity-callbacks[description of available callbacks] which map 1:1 to events.
4444

4545
.Available events
4646
|===

src/main/antora/modules/ROOT/pages/jdbc/getting-started.adoc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Spring Data JDBC includes direct support for the following databases:
2121
* Microsoft SQL Server
2222
* MySQL
2323
* Oracle
24-
* Postgres
24+
* PostgreSQL
2525

2626
If you use a different database then your application won’t start up.
2727
The <<jdbc.dialects,dialect>> section contains further detail on how to proceed in such case.
@@ -33,7 +33,7 @@ To create a Spring project in STS:
3333

3434
. Go to File -> New -> Spring Template Project -> Simple Spring Utility Project, and press Yes when prompted.
3535
Then enter a project and a package name, such as `org.spring.jdbc.example`.
36-
. Add the following to the `pom.xml` files `dependencies` element:
36+
. Add the following to the `pom.xml` file `dependencies` element:
3737
+
3838
[source,xml,subs="+attributes"]
3939
----
@@ -77,7 +77,7 @@ The repository is also https://repo.spring.io/milestone/org/springframework/data
7777

7878
Spring Data JDBC does little to no logging on its own.
7979
Instead, the mechanics of `JdbcTemplate` to issue SQL statements provide logging.
80-
Thus, if you want to inspect what SQL statements are run, activate logging for Spring's {spring-framework-docs}/data-access.html#jdbc-JdbcTemplate[`NamedParameterJdbcTemplate`] or https://www.mybatis.org/mybatis-3/logging.html[MyBatis].
80+
Thus, if you want to inspect what SQL statements are run, activate logging for Spring's {spring-framework-docs}/data-access/jdbc/core.html#jdbc-NamedParameterJdbcTemplate[`NamedParameterJdbcTemplate`] or https://www.mybatis.org/mybatis-3/logging.html[MyBatis].
8181

8282
You may also want to set the logging level to `DEBUG` to see some additional information.
8383
To do so, edit the `application.properties` file to have the following content:
@@ -125,8 +125,8 @@ class ApplicationConfig extends AbstractJdbcConfiguration {
125125
}
126126
----
127127

128-
<1> `@EnableJdbcRepositories` creates implementations for interfaces derived from `Repository`
129-
<2> javadoc:org.springframework.data.jdbc.repository.config.AbstractJdbcConfiguration[] provides various default beans required by Spring Data JDBC
128+
<1> `@EnableJdbcRepositories` creates implementations for interfaces derived from `Repository`.
129+
<2> javadoc:org.springframework.data.jdbc.repository.config.AbstractJdbcConfiguration[] provides various default beans required by Spring Data JDBC.
130130
<3> Creates a `DataSource` connecting to a database.
131131
This is required by the following two bean methods.
132132
<4> Creates the `NamedParameterJdbcOperations` used by Spring Data JDBC to access the database.
@@ -158,13 +158,13 @@ Alternatively, you can implement your own `Dialect`.
158158

159159
[TIP]
160160
====
161-
Dialects are resolved by javadoc:org.springframework.data.jdbc.core.dialect.DialectResolver[] from a `JdbcOperations` instance, typically by inspecting `Connection.getMetaData()`.
162-
+ You can let Spring auto-discover your javadoc:org.springframework.data.jdbc.core.dialect.JdbcDialect[] by registering a class that implements `org.springframework.data.jdbc.core.dialect.DialectResolver$JdbcDialectProvider` through `META-INF/spring.factories`.
161+
Dialects are resolved by javadoc:org.springframework.data.jdbc.core.dialect.DialectResolver[] from a `JdbcOperations` instance, typically by inspecting `Connection.getMetaData()`. +
162+
You can let Spring auto-discover your javadoc:org.springframework.data.jdbc.core.dialect.JdbcDialect[] by registering a class that implements `org.springframework.data.jdbc.core.dialect.DialectResolver$JdbcDialectProvider` through `META-INF/spring.factories`.
163163
`DialectResolver` discovers dialect provider implementations from the class path using Spring's `SpringFactoriesLoader`.
164164
To do so:
165165
166166
. Implement your own `Dialect`.
167167
. Implement a `JdbcDialectProvider` returning the `Dialect`.
168168
. Register the provider by creating a `spring.factories` resource under `META-INF` and perform the registration by adding a line +
169-
`org.springframework.data.jdbc.core.dialect.DialectResolver$JdbcDialectProvider`=<fully qualified name of your JdbcDialectProvider>`
169+
`org.springframework.data.jdbc.core.dialect.DialectResolver$JdbcDialectProvider`=<fully qualified name of your JdbcDialectProvider>`.
170170
====

src/main/antora/modules/ROOT/pages/jdbc/mapping.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ The properties of the following types are currently supported:
4242

4343
* All primitive types and their boxed types (`int`, `float`, `Integer`, `Float`, and so on)
4444

45-
* Enums get mapped to their name.
45+
* Enums get mapped to their names.
4646

4747
* `String`
4848

@@ -135,7 +135,7 @@ p1.bestFriend = AggregateReference.to(p2.id);
135135
----
136136

137137
You should not include attributes in your entities to hold the actual value of a back reference, nor of the key column of maps or lists.
138-
If you want these value to be available in your domain model we recommend to do this in a `AfterConvertCallback` and store the values in transient values.
138+
If you want these values to be available in your domain model we recommend to do this in an `AfterConvertCallback` and store the values in transient values.
139139

140140
:mapped-collection: true
141141
:embedded-entities: true
@@ -214,7 +214,7 @@ If you are migrating from an older version of Spring Data JDBC and have `Abstrac
214214
[TIP]
215215
====
216216
If you want to rely on https://spring.io/projects/spring-boot[Spring Boot] to bootstrap Spring Data JDBC, but still want to override certain aspects of the configuration, you may want to expose beans of that type.
217-
For custom conversions you may e.g. choose to register a bean of type `JdbcCustomConversions` that will be picked up the by the Boot infrastructure.
217+
For custom conversions you may e.g. choose to register a bean of type `JdbcCustomConversions` that will be picked up by the Boot infrastructure.
218218
To learn more about this please make sure to read the Spring Boot https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#data.sql.jdbc[Reference Documentation].
219219
====
220220

src/main/antora/modules/ROOT/pages/jdbc/mybatis.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,20 @@ The following table describes the available MyBatis statements:
4444
| Name | Purpose | CrudRepository methods that might trigger this statement | Attributes available in the `MyBatisContext`
4545

4646
| `insert` | Inserts a single entity. This also applies for entities referenced by the aggregate root. | `save`, `saveAll`. |
47-
`getInstance`: the instance to be saved
47+
`getInstance`: the instance to be saved.
4848

4949
`getDomainType`: The type of the entity to be saved.
5050

5151
`get(<key>)`: ID of the referencing entity, where `<key>` is the name of the back reference column provided by the `NamingStrategy`.
5252

5353

5454
| `update` | Updates a single entity. This also applies for entities referenced by the aggregate root. | `save`, `saveAll`.|
55-
`getInstance`: The instance to be saved
55+
`getInstance`: The instance to be saved.
5656

5757
`getDomainType`: The type of the entity to be saved.
5858

5959
| `delete` | Deletes a single entity. | `delete`, `deleteById`.|
60-
`getId`: The ID of the instance to be deleted
60+
`getId`: The ID of the instance to be deleted.
6161

6262
`getDomainType`: The type of the entity to be deleted.
6363

src/main/antora/modules/ROOT/pages/jdbc/query-methods.adoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
This section offers some specific information about the implementation and use of Spring Data JDBC.
55

6-
Most of the data access operations you usually trigger on a repository result in a query being run against the databases.
6+
Most of the data access operations you usually trigger on a repository result in a query being run against the database.
77
Defining such a query is a matter of declaring a method on the repository interface, as the following example shows:
88

99
.PersonRepository with query methods
@@ -36,7 +36,7 @@ interface PersonRepository extends PagingAndSortingRepository<Person, String> {
3636
The query is derived by parsing the method name for constraints that can be concatenated with `And` and `Or`.
3737
Thus, the method name results in a query expression of `SELECT … FROM person WHERE firstname = :firstname`.
3838
<2> Use `Pageable` to pass offset and sorting parameters to the database.
39-
<3> Return a `Slice<Person>`.Selects `LIMIT+1` rows to determine whether there's more data to consume. `ResultSetExtractor` customization is not supported.
39+
<3> Return a `Slice<Person>`. Selects `LIMIT+1` rows to determine whether there's more data to consume. `ResultSetExtractor` customization is not supported.
4040
<4> Run a paginated query returning `Page<Person>`.Selects only data within the given page bounds and potentially a count query to determine the total count. `ResultSetExtractor` customization is not supported.
4141
<5> Find a single entity for the given criteria.
4242
It completes with `IncorrectResultSizeDataAccessException` on non-unique results.
@@ -143,7 +143,7 @@ NOTE: Query derivation is limited to properties that can be used in a `WHERE` cl
143143

144144
The JDBC module supports defining a query manually as a String in a `@Query` annotation or as named query in a property file.
145145

146-
Deriving a query from the name of the method is is currently limited to simple properties, that means properties present in the aggregate root directly.
146+
Deriving a query from the name of the method is currently limited to simple properties, that means properties present in the aggregate root directly.
147147
Also, only select queries are supported by this approach.
148148

149149
[[jdbc.query-methods.at-query]]
@@ -164,12 +164,12 @@ interface UserRepository extends CrudRepository<User, Long> {
164164
For converting the query result into entities the same `RowMapper` is used by default as for the queries Spring Data JDBC generates itself.
165165
The query you provide must match the format the `RowMapper` expects.
166166
Columns for all properties that are used in the constructor of an entity must be provided.
167-
Columns for properties that get set via setter, wither or field access are optional.
167+
Columns for properties that get set via setter or field access are optional.
168168
Properties that don't have a matching column in the result will not be set.
169169
The query is used for populating the aggregate root, embedded entities and one-to-one relationships including arrays of primitive types which get stored and loaded as SQL-array-types.
170170
Separate queries are generated for maps, lists, sets and arrays of entities.
171171

172-
Properties one-to-one relationships must have there name prefixed by the name of the relationship plus `_`.
172+
Properties one-to-one relationships must have their name prefixed by the name of the relationship plus `_`.
173173
For example if the `User` from the example above has an `address` with the property `city` the column for that `city` must be labeled `address_city`.
174174

175175

@@ -190,7 +190,7 @@ Person findWithSpEL(PersonRef person);
190190
----
191191

192192
This can be used to access members of a parameter, as demonstrated in the example above.
193-
For more involved use cases an `EvaluationContextExtension` can be made available in the application context, which in turn can make any object available in to the SpEL.
193+
For more involved use cases an `EvaluationContextExtension` can be made available in the application context, which in turn can make any object available in the SpEL.
194194

195195
The other variant can be used anywhere in the query and the result of evaluating the query will replace the expression in the query string.
196196

src/main/antora/modules/ROOT/pages/jdbc/schema-support.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@ databaseChangeLog:
7373
----
7474

7575
Column types are computed from an object implementing the `SqlTypeMapping` strategy interface.
76-
Nullability is inferred from the type and set to `false` if a property type use primitive Java types.
76+
Nullability is inferred from the type and set to `false` if a property type uses primitive Java types.
7777

7878
Schema support can assist you throughout the application development lifecycle.
7979
In differential mode, you provide an existing Liquibase `Database` to the schema writer instance and the schema writer compares existing tables to mapped entities and derives from the difference which tables and columns to create/to drop.
8080
By default, no tables and no columns are dropped unless you configure `dropTableFilter` and `dropColumnFilter`.
81-
Both filter predicate provide the table name respective column name so your code can computer which tables and columns can be dropped.
81+
Both filter predicates provide the table name respective column name so your code can compute which tables and columns can be dropped.
8282

8383
[source,java]
8484
----

src/main/antora/modules/ROOT/pages/jdbc/transactions.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ Thus, the method is with the `readOnly` flag set to `false`.
8686
NOTE: It is highly recommended to make query methods transactional.
8787
These methods might execute more than one query in order to populate an entity.
8888
Without a common transaction Spring Data JDBC executes the queries in different connections.
89-
This may put excessive strain on the connection pool and might even lead to dead locks when multiple methods request a fresh connection while holding on to one.
89+
This may put excessive strain on the connection pool and might even lead to deadlocks when multiple methods request a fresh connection while holding on to one.
9090

9191
NOTE: It is definitely reasonable to mark read-only queries as such by setting the `readOnly` flag.
9292
This does not, however, act as a check that you do not trigger a manipulating query (although some databases reject `INSERT` and `UPDATE` statements inside a read-only transaction).
@@ -112,7 +112,7 @@ interface UserRepository extends CrudRepository<User, Long> {
112112
----
113113

114114
As you can see above, the method `findByLastname(String lastname)` will be executed with a pessimistic read lock.
115-
If you are using a databse with the MySQL Dialect this will result for example in the following query:
115+
If you are using a database with the MySQL Dialect this will result for example in the following query:
116116

117117
.Resulting Sql query for MySQL dialect
118118
[source,sql]
@@ -121,7 +121,7 @@ Select * from user u where u.lastname = lastname LOCK IN SHARE MODE
121121
----
122122

123123
NOTE: `@Lock` is currently not supported on string-based queries.
124-
Query-methods created with `@Query`, will ignore the locking information provided by the `@Lock`,
125-
Using `@Lock` on string-based queries will result in the warning in logs.
124+
Query-methods created with `@Query` will ignore the locking information provided by the `@Lock`,
125+
Using `@Lock` on string-based queries will result in a warning in logs.
126126
Future versions will throw an exception.
127127

src/main/antora/modules/ROOT/pages/r2dbc.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ We provide a "`template`" as a high-level abstraction for storing and querying a
88
This document is the reference guide for Spring Data R2DBC support.
99
It explains the concepts and semantics and syntax.
1010

11-
This chapter points out the specialties for repository support for JDBC.
11+
This chapter points out the specialties for repository support for R2DBC.
1212
This builds on the core repository support explained in xref:repositories/introduction.adoc[Working with Spring Data Repositories].
1313
You should have a sound understanding of the basic concepts explained there.
1414

src/main/antora/modules/ROOT/partials/mapping.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,11 @@ CREATE TABLE PERSON_WITH_COMPOSITE_ID (
185185
186186
----
187187
188-
<1> Entities may be represented as records without any special consideration
188+
<1> Entities may be represented as records without any special consideration.
189189
<2> `pk` is marked as id and embedded
190-
<3> the two columns from the embedded `Name` entity make up the primary key in the database.
190+
<3> The two columns from the embedded `Name` entity make up the primary key in the database.
191191
192-
Details of table creation depends on the used database.
192+
Details of table creation depend on the used database.
193193
====
194194

195195
[[entity-persistence.read-only-properties]]

0 commit comments

Comments
 (0)