Skip to content

Commit 7dea268

Browse files
committed
Polish contribution
See gh-24398
1 parent 9b82728 commit 7dea268

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

src/docs/asciidoc/data-access.adoc

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2730,13 +2730,13 @@ The following query finds and populates a single domain object:
27302730
[source,java,indent=0,subs="verbatim,quotes",role="primary"]
27312731
.Java
27322732
----
2733-
Actor actor = this.jdbcTemplate.queryForObject(
2733+
Actor actor = jdbcTemplate.queryForObject(
27342734
"select first_name, last_name from t_actor where id = ?",
27352735
(resultSet, rowNum) -> {
2736-
Actor newActor = new Actor();
2737-
newActor.setFirstName(resultSet.getString("first_name"));
2738-
newActor.setLastName(resultSet.getString("last_name"));
2739-
return newActor;
2736+
Actor actor = new Actor();
2737+
actor.setFirstName(resultSet.getString("first_name"));
2738+
actor.setLastName(resultSet.getString("last_name"));
2739+
return actor;
27402740
},
27412741
1212L);
27422742
----
@@ -2750,7 +2750,7 @@ The following query finds and populates a single domain object:
27502750
}
27512751
----
27522752

2753-
The following query finds and populates a number of domain objects:
2753+
The following query finds and populates a list of domain objects:
27542754

27552755
[source,java,indent=0,subs="verbatim,quotes",role="primary"]
27562756
.Java
@@ -2771,7 +2771,6 @@ The following query finds and populates a number of domain objects:
27712771
Actor(rs.getString("first_name"), rs.getString("last_name"))
27722772
----
27732773

2774-
27752774
If the last two snippets of code actually existed in the same application, it would make
27762775
sense to remove the duplication present in the two `RowMapper` lambda expressions and
27772776
extract them out into a single field that could then be referenced by DAO methods as needed.
@@ -2780,7 +2779,6 @@ For example, it may be better to write the preceding code snippet as follows:
27802779
[source,java,indent=0,subs="verbatim,quotes",role="primary"]
27812780
.Java
27822781
----
2783-
27842782
private final RowMapper<Actor> actorRowMapper = (resultSet, rowNum) -> {
27852783
Actor actor = new Actor();
27862784
actor.setFirstName(resultSet.getString("first_name"));
@@ -2791,7 +2789,6 @@ For example, it may be better to write the preceding code snippet as follows:
27912789
public List<Actor> findAllActors() {
27922790
return this.jdbcTemplate.query( "select first_name, last_name from t_actor", actorRowMapper);
27932791
}
2794-
27952792
----
27962793
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
27972794
.Kotlin
@@ -4043,10 +4040,10 @@ The following example shows a batch update that uses a batch size of 100:
40434040
"update t_actor set first_name = ?, last_name = ? where id = ?",
40444041
actors,
40454042
100,
4046-
(PreparedStatement ps, Actor argument) -> {
4047-
ps.setString(1, argument.getFirstName());
4048-
ps.setString(2, argument.getLastName());
4049-
ps.setLong(3, argument.getId().longValue());
4043+
(PreparedStatement ps, Actor actor) -> {
4044+
ps.setString(1, actor.getFirstName());
4045+
ps.setString(2, actor.getLastName());
4046+
ps.setLong(3, actor.getId().longValue());
40504047
});
40514048
return updateCounts;
40524049
}
@@ -5542,9 +5539,9 @@ database. To accommodate these types, Spring provides a `SqlReturnType` for hand
55425539
them when they are returned from the stored procedure call and `SqlTypeValue` when they
55435540
are passed in as a parameter to the stored procedure.
55445541

5545-
The `SqlReturnType` interface has a single method (named
5546-
`getTypeValue`) that must be implemented. This interface is used as part of the
5547-
declaration of an `SqlOutParameter`. The following example shows returning the value of an Oracle `STRUCT` object of the user
5542+
The `SqlReturnType` interface has a single method (named `getTypeValue`) that must be
5543+
implemented. This interface is used as part of the declaration of an `SqlOutParameter`.
5544+
The following example shows returning the value of an Oracle `STRUCT` object of the user
55485545
declared type `ITEM_TYPE`:
55495546

55505547
[source,java,indent=0,subs="verbatim,quotes",role="primary"]

0 commit comments

Comments
 (0)