-
Couldn't load subscription status.
- Fork 377
cosmetic doc improvements for jdbc component #2148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ | |
|
|
||
| This section offers some specific information about the implementation and use of Spring Data JDBC. | ||
|
|
||
| Most of the data access operations you usually trigger on a repository result in a query being run against the databases. | ||
| Most of the data access operations you usually trigger on a repository result in a query being run against the database. | ||
| Defining such a query is a matter of declaring a method on the repository interface, as the following example shows: | ||
|
|
||
| .PersonRepository with query methods | ||
|
|
@@ -36,7 +36,7 @@ interface PersonRepository extends PagingAndSortingRepository<Person, String> { | |
| The query is derived by parsing the method name for constraints that can be concatenated with `And` and `Or`. | ||
| Thus, the method name results in a query expression of `SELECT … FROM person WHERE firstname = :firstname`. | ||
| <2> Use `Pageable` to pass offset and sorting parameters to the database. | ||
| <3> Return a `Slice<Person>`.Selects `LIMIT+1` rows to determine whether there's more data to consume. `ResultSetExtractor` customization is not supported. | ||
| <3> Return a `Slice<Person>`. Selects `LIMIT+1` rows to determine whether there's more data to consume. `ResultSetExtractor` customization is not supported. | ||
| <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. | ||
| <5> Find a single entity for the given criteria. | ||
| 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 | |
|
|
||
| The JDBC module supports defining a query manually as a String in a `@Query` annotation or as named query in a property file. | ||
|
|
||
| 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. | ||
| Deriving a query from the name of the method is currently limited to simple properties, that means properties present in the aggregate root directly. | ||
| Also, only select queries are supported by this approach. | ||
|
|
||
| [[jdbc.query-methods.at-query]] | ||
|
|
@@ -164,12 +164,12 @@ interface UserRepository extends CrudRepository<User, Long> { | |
| For converting the query result into entities the same `RowMapper` is used by default as for the queries Spring Data JDBC generates itself. | ||
| The query you provide must match the format the `RowMapper` expects. | ||
| Columns for all properties that are used in the constructor of an entity must be provided. | ||
| Columns for properties that get set via setter, wither or field access are optional. | ||
| Columns for properties that get set via setter or field access are optional. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure about the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not a typo. A "Wither" is similar to a getter but for immutable objects which returns an object wich is a copy of the original one but with a single property changed. Something like |
||
| Properties that don't have a matching column in the result will not be set. | ||
| 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. | ||
| Separate queries are generated for maps, lists, sets and arrays of entities. | ||
|
|
||
| Properties one-to-one relationships must have there name prefixed by the name of the relationship plus `_`. | ||
| Properties one-to-one relationships must have their name prefixed by the name of the relationship plus `_`. | ||
| 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`. | ||
|
|
||
|
|
||
|
|
@@ -190,7 +190,7 @@ Person findWithSpEL(PersonRef person); | |
| ---- | ||
|
|
||
| This can be used to access members of a parameter, as demonstrated in the example above. | ||
| 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. | ||
| 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. | ||
|
|
||
| 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. | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume the intention was to insert a hard line break here. Currently, a literal "+" is displayed in the resulting doc instead.