Skip to content

Commit 2898e21

Browse files
Chr1st0phschauder
authored andcommitted
DATAJDBC-194 - Polish README.adoc.
Typos, links, grammar and similar fixed. Original pull request: #56.
1 parent c7958f8 commit 2898e21

File tree

1 file changed

+34
-34
lines changed

1 file changed

+34
-34
lines changed

README.adoc

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ Spring Data JDBC tries its best to encourage modelling your domain along these i
3434

3535
=== CRUD operations
3636

37-
In order use Spring Data JDBC you need the following:
37+
In order to use Spring Data JDBC you need the following:
3838

39-
1. An entity with an attribute marked as _id_ using the spring datas https://docs.spring.io/spring-data/commons/docs/current/api/org/springframework/data/annotation/Id.html[`@Id`] annotation.
39+
1. An entity with an attribute marked as _id_ using the Spring Data https://docs.spring.io/spring-data/commons/docs/current/api/org/springframework/data/annotation/Id.html[`@Id`] annotation.
4040
+
4141
[source,java]
4242
----
@@ -90,26 +90,26 @@ This name can be changed by implementing `NamingStrategy.getReverseColumnName(Jd
9090
The table of the referenced entity is expected to have an additional column named like the table of the referencing entity.
9191
This name can be changed by implementing `NamingStrategy.getReverseColumnName(JdbcPersistentProperty property)` according to your preferences.
9292

93-
* `Map<simple type, some entity>` will be considered a qualified one to many relationship.
93+
* `Map<simple type, some entity>` will be considered a qualified one-to-many relationship.
9494
The table of the referenced entity is expected to have two additional columns: One named like the table of the referencing entity for the foreign key and one with the same name and an additional `_key` suffix for the map key.
9595
This name can be changed by implementing `NamingStrategy.getReverseColumnName(JdbcPersistentProperty property)` and `NamingStrategy.getKeyColumn(JdbcPersistentProperty property)` according to your preferences.
9696

9797
The handling of referenced entities is very limited.
98-
Part of this is because this project is still before it's first release.
98+
Part of this is because this project is still before its first release.
9999

100100
But another reason is the idea of <<The Aggregate Root,Aggregate Roots>> as described above.
101101
If you reference another entity that entity is by definition part of your Aggregate.
102102
So if you remove the reference it will get deleted.
103103
This also means references will be 1-1 or 1-n, but not n-1 or n-m.
104104

105-
If your having n-1 or n-m references you are probably dealing with two separate Aggregates.
106-
References between those should be encode as simple ids, which should map just fine with Spring Data JDBC.
105+
If you are having n-1 or n-m references you are probably dealing with two separate Aggregates.
106+
References between those should be encoded as simple ids, which should map just fine with Spring Data JDBC.
107107

108-
Also the mapping we offer is very limited for a third reason which already was mentioned at the very beginning of the document: This is not an ORM.
108+
Also the mapping we offer is very limited for a third reason which already was mentioned at the very beginning of the document: this is not an ORM.
109109
We will offer ways to plug in your own SQL in various ways.
110110
But the default mapping itself will stay limited.
111-
If you want highly customizable mappings which support almost everything one can imagine you will probably be much happier with (Spring Data) JPA.
112-
Which is a very powerful and mature technology.
111+
If you want highly customizable mappings which support almost everything one can imagine you will probably be much happier with (Spring Data) JPA,
112+
which is a very powerful and mature technology.
113113

114114
=== Query annotation
115115

@@ -126,7 +126,7 @@ If you compile your sources with the `-parameters` compiler flag you can omit th
126126

127127
==== Custom RowMapper
128128

129-
You can configure the `RowMapper` to use using either the `@Query(rowMapperClass = ....)` or you can register a `RowMapperMap` bean and register `RowMapper` per method return type.
129+
You can configure the `RowMapper` to use, using either the `@Query(rowMapperClass = ....)` or you can register a `RowMapperMap` bean and register `RowMapper` per method return type.
130130

131131
[source,java]
132132
----
@@ -142,39 +142,39 @@ You can configure the `RowMapper` to use using either the `@Query(rowMapperClass
142142

143143
When determining the `RowMapper` to use for a method the following steps are followed based on the return type of the method:
144144

145-
1. If the type is a simple type no `RowMapper` is used.
145+
1. If the type is a simple type, no `RowMapper` is used.
146146
Instead the query is expected to return a single row with a single column and a conversion to the return type is applied to that value.
147147

148148
2. The entity classes in the `RowMapperMap` are iterated until one is found that is a superclass or interface of the return type in question.
149149
The `RowMapper` registered for that class is used.
150150
Iterating happens in the order of registration, so make sure to register more general types after specific ones.
151151

152-
If applicable wrapper type like collections or `Optional` are unwrapped.
153-
So a return type of `Optional<Person>` will use the type `Person` in the steps above.
152+
If applicable, wrapper types like collections or `Optional` are unwrapped.
153+
Thus, a return type of `Optional<Person>` will use the type `Person` in the steps above.
154154

155155
=== Id generation
156156

157-
Spring Data JDBC uses the id to identify entities but also to determine if an entity is new or already existing in the database.
158-
If the id is `null` or of a primitive type and `0` or `0.0` the entity is considered new.
157+
Spring Data JDBC uses the id to identify entities, but also to determine if an entity is new or already existing in the database.
158+
If the id is `null` or of a primitive type having value `0` or `0.0`, the entity is considered new.
159159

160-
When your data base has some autoincrement column for the id column the generated value will get set in the entity after inserting it into the database.
160+
If your database has some autoincrement-column for the id-column, the generated value will get set in the entity after inserting it into the database.
161161

162162
There are few ways to tweak this behavior.
163163
If you don't like the logic to distinguish between new and existing entities you can implement https://docs.spring.io/spring-data/commons/docs/current/api/org/springframework/data/domain/Persistable.html[`Persistable`] with your entity and overwrite `isNew()` with your own logic.
164164

165165
One important constraint is that after saving an entity the entity shouldn't be _new_ anymore.
166-
With autoincrement columns this happens automatically since the the id gets set by Spring Data with the value from the id column.
167-
If you are not using autoincrement columns you can use that using a `BeforeSave`-listener which sets the id of the entity (see below).
166+
With autoincrement-columns this happens automatically since the id gets set by Spring Data with the value from the id-column.
167+
If you are not using autoincrement-columns, you can use a `BeforeSave`-listener which sets the id of the entity (see below).
168168

169169
=== NamingStrategy
170170

171-
When you use the standard implementations of `CrudRepository` as provided by Spring Data JDBC it will expect a certain table structure.
171+
If you use the standard implementations of `CrudRepository` as provided by Spring Data JDBC, it will expect a certain table structure.
172172
You can tweak that by providing a https://github.com/spring-projects/spring-data-jdbc/blob/master/src/main/java/org/springframework/data/jdbc/mapping/model/NamingStrategy.java[`NamingStrategy`] in your application context.
173173

174174
=== Events
175175

176-
Spring Data Jdbc triggers events which will get publish to any matching `ApplicationListener` in the application context.
177-
For example the following listener will get invoked before an aggregate gets saved.
176+
Spring Data JDBC triggers events which will get published to any matching `ApplicationListener` in the application context.
177+
For example, the following listener will get invoked before an Aggregate gets saved.
178178

179179
[source,java]
180180
----
@@ -202,27 +202,27 @@ public ApplicationListener<BeforeSave> timeStampingSaveTime() {
202202
| https://github.com/spring-projects/spring-data-jdbc/blob/master/src/main/java/org/springframework/data/jdbc/mapping/event/AfterDelete.java[`AfterDelete`]
203203
| after an aggregate root got deleted.
204204

205-
| https://github.com/spring-projects/spring-data-jdbc/blob/master/src/main/java/org/springframework/data/jdbc/mapping/event/AfterDelete.java[`BeforeSave`]
205+
| https://github.com/spring-projects/spring-data-jdbc/blob/master/src/main/java/org/springframework/data/jdbc/mapping/event/BeforeSave.java[`BeforeSave`]
206206
| before an aggregate root gets saved, i.e. inserted or updated but after the decision was made if it will get updated or deleted.
207207
The event has a reference to an https://github.com/spring-projects/spring-data-jdbc/blob/master/src/main/java/org/springframework/data/jdbc/core/conversion/AggregateChange.java[`AggregateChange`] instance.
208208
The instance can be modified by adding or removing https://github.com/spring-projects/spring-data-jdbc/blob/master/src/main/java/org/springframework/data/jdbc/core/conversion/DbAction.java[`DbAction`]s.
209209

210210
| https://github.com/spring-projects/spring-data-jdbc/blob/master/src/main/java/org/springframework/data/jdbc/mapping/event/AfterSave.java[`AfterSave`]
211211
| after an aggregate root gets saved, i.e. inserted or updated.
212212

213-
| https://github.com/spring-projects/spring-data-jdbc/blob/master/src/main/java/org/springframework/data/jdbc/mapping/event/AfterDelete.java[`AfterCreation`]
213+
| https://github.com/spring-projects/spring-data-jdbc/blob/master/src/main/java/org/springframework/data/jdbc/mapping/event/AfterCreation.java[`AfterCreation`]
214214
| after an aggregate root got created from a database `ResultSet` and all it's property set
215215
|===
216216

217217

218218
=== MyBatis
219219

220-
For each operation in `CrudRepository` Spring Data Jdbc will execute multiple statements.
221-
If there is a https://github.com/mybatis/mybatis-3/blob/master/src/main/java/org/apache/ibatis/session/SqlSessionFactory.java[`SqlSessionFactory`] in the application context, it will checked if it offers a statement for each step.
222-
If one is found that statement will be used (including its configured mapping to an entity).
220+
For each operation in `CrudRepository` Spring Data JDBC will execute multiple statements.
221+
If there is a https://github.com/mybatis/mybatis-3/blob/master/src/main/java/org/apache/ibatis/session/SqlSessionFactory.java[`SqlSessionFactory`] in the application context, it will be checked if it offers a statement for each step.
222+
If one is found, that statement will be used (including its configured mapping to an entity).
223223

224224
The name of the statement is constructed by concatenating the fully qualified name of the entity type with `Mapper.` and a string determining the kind of statement.
225-
E.g. if an instance of `org.example.User` is to be inserted Spring Data Jdbc will look for a statement named `org.example.UserMapper.insert`.
225+
E.g. if an instance of `org.example.User` is to be inserted, Spring Data JDBC will look for a statement named `org.example.UserMapper.insert`.
226226

227227
Upon execution of the statement an instance of [`MyBatisContext`] will get passed as an argument which makes various arguments available to the statement.
228228

@@ -250,7 +250,7 @@ Upon execution of the statement an instance of [`MyBatisContext`] will get passe
250250
`getDomainType`: the type of the entity to be deleted.
251251

252252
| `deleteAll.<propertyPath>` | Delete all entities referenced by any aggregate root of the type used as prefix via the given property path.
253-
Note that the type used for prefixing the statement name is the name of the aggregate root not the one of the entity to be deleted. | `deleteAll`.|
253+
Note that the type used for prefixing the statement name is the name of the aggregate root, not the one of the entity to be deleted. | `deleteAll`.|
254254

255255
`getDomainType`: the type of the entities to be deleted.
256256

@@ -293,9 +293,9 @@ Note that the type used for prefixing the statement name is the name of the aggr
293293
`getDomainType` the type of aggregate roots to count.
294294
|===
295295

296-
== Features planned for the not to far future
296+
== Features planned for the not too distant future
297297

298-
=== Advance query annotation support
298+
=== Advanced query annotation support
299299

300300
* customizable `RowMapper`
301301
* projections
@@ -305,7 +305,7 @@ Note that the type used for prefixing the statement name is the name of the aggr
305305
=== MyBatis per method support
306306

307307
The current MyBatis supported is rather elaborate in that it allows to execute multiple statements for a single method call.
308-
But sometimes less is more and it should be possible to annotate a method with a simple annotation to identify a SQL statement in a MyBatis mapping to be executed.
308+
But sometimes less is more, and it should be possible to annotate a method with a simple annotation to identify a SQL statement in a MyBatis mapping to be executed.
309309

310310
=== Support of lists in entities
311311

@@ -318,7 +318,7 @@ Currently you will need to build it locally.
318318
== Getting Help
319319

320320
Right now the best source of information is the source code in this repository.
321-
Especially the integration tests (When you are reading this on github type `t` and then `IntegrationTests.java`)
321+
Especially the integration tests (if you are reading this on github, type `t` and then `IntegrationTests.java`)
322322

323323
We are keeping an eye on the (soon to be created) https://stackoverflow.com/questions/tagged/spring-data-jdbc[spring-data-jdbc tag on stackoverflow].
324324

@@ -328,7 +328,7 @@ If you think you found a bug, or have a feature request please https://jira.spri
328328

329329
=== Fast running tests
330330

331-
Fast running tests can executed with a simple
331+
Fast running tests can be executed with a simple
332332

333333
[source]
334334
----
@@ -369,7 +369,7 @@ Here are some ways for you to get involved in the community:
369369

370370
* Get involved with the Spring community by helping out on http://stackoverflow.com/questions/tagged/spring-data-jdbc[stackoverflow] by responding to questions and joining the debate.
371371
* Create https://jira.spring.io/browse/DATAJDBC[JIRA] tickets for bugs and new features and comment and vote on the ones that you are interested in.
372-
* Github is for social coding: if you want to write code, we encourage contributions through pull requests from http://help.github.com/forking/[forks of this repository]. If you want to contribute code this way, please reference a JIRA ticket as well covering the specific issue you are addressing.
372+
* Github is for social coding: if you want to write code, we encourage contributions through pull requests from http://help.github.com/forking/[forks of this repository]. If you want to contribute code this way, please reference a JIRA ticket as well, covering the specific issue you are addressing.
373373
* Watch for upcoming articles on Spring by http://spring.io/blog[subscribing] to spring.io.
374374

375375
Before we accept a non-trivial patch or pull request we will need you to https://cla.pivotal.io/sign/spring[sign the Contributor License Agreement]. Signing the contributor’s agreement does not grant anyone commit rights to the main repository, but it does mean that we can accept your contributions, and you will get an author credit if we do. If you forget to do so, you'll be reminded when you submit a pull request. Active contributors might be asked to join the core team, and given the ability to merge pull requests.

0 commit comments

Comments
 (0)