|
|
|
|
@@ -582,7 +582,7 @@ transactions be created and then rolled back in response to the
|
|
|
|
|
----
|
|
|
|
|
====
|
|
|
|
|
|
|
|
|
|
The following exampl shows an implementation of the preceding interface:
|
|
|
|
|
The following example shows an implementation of the preceding interface:
|
|
|
|
|
|
|
|
|
|
====
|
|
|
|
|
[source,java,indent=0]
|
|
|
|
|
@@ -1004,7 +1004,7 @@ transactional settings:
|
|
|
|
|
[[transaction-declarative-txadvice-settings]]
|
|
|
|
|
==== <tx:advice/> Settings
|
|
|
|
|
|
|
|
|
|
This section summarizes the various transactional settings that you can specifyi by using
|
|
|
|
|
This section summarizes the various transactional settings that you can specify by using
|
|
|
|
|
the `<tx:advice/>` tag. The default `<tx:advice/>` settings are:
|
|
|
|
|
|
|
|
|
|
* The <<tx-propagation,propagation setting>> is `REQUIRED.`
|
|
|
|
|
@@ -1314,15 +1314,15 @@ properties of the `@Transactional` annotation:
|
|
|
|
|
|
|
|
|
|
| `isolation`
|
|
|
|
|
| `enum`: `Isolation`
|
|
|
|
|
| Optional isolation level. Applies only to propagation valeus of `REQUIRED` or `REQUIRES_NEW`.
|
|
|
|
|
| Optional isolation level. Applies only to propagation values of `REQUIRED` or `REQUIRES_NEW`.
|
|
|
|
|
|
|
|
|
|
| `timeout`
|
|
|
|
|
| `int` (in seconds of granularity)
|
|
|
|
|
| Optional transaction timeout. Applies only to propagation valeus of `REQUIRED` or `REQUIRES_NEW`.
|
|
|
|
|
| Optional transaction timeout. Applies only to propagation values of `REQUIRED` or `REQUIRES_NEW`.
|
|
|
|
|
|
|
|
|
|
| `readOnly`
|
|
|
|
|
| `boolean`
|
|
|
|
|
| Read-write versus read-only transaction. Only applicable to valeus of `REQUIRED` or `REQUIRES_NEW`.
|
|
|
|
|
| Read-write versus read-only transaction. Only applicable to values of `REQUIRED` or `REQUIRES_NEW`.
|
|
|
|
|
|
|
|
|
|
| `rollbackFor`
|
|
|
|
|
| Array of `Class` objects, which must be derived from `Throwable.`
|
|
|
|
|
@@ -2059,7 +2059,7 @@ per-transaction isolation levels, and proper resuming of transactions in all cas
|
|
|
|
|
[[transaction-solutions-to-common-problems]]
|
|
|
|
|
=== Solutions to Common Problems
|
|
|
|
|
|
|
|
|
|
This section describes solutions to some commmon problems.
|
|
|
|
|
This section describes solutions to some common problems.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[[transaction-solutions-to-common-problems-wrong-ptm]]
|
|
|
|
|
@@ -2375,7 +2375,7 @@ including error handling. It includes the following topics:
|
|
|
|
|
* <<jdbc-statements-executing>>
|
|
|
|
|
* <<jdbc-statements-querying>>
|
|
|
|
|
* <<jdbc-updates>>
|
|
|
|
|
* <<jdbc-auto-genereted-keys>>
|
|
|
|
|
* <<jdbc-auto-generated-keys>>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[[jdbc-JdbcTemplate]]
|
|
|
|
|
@@ -2522,7 +2522,7 @@ preceding code snippet as follows:
|
|
|
|
|
===== Updating (`INSERT`, `UPDATE`, and `DELETE`) with `JdbcTemplate`
|
|
|
|
|
|
|
|
|
|
You can use the `update(..)` method to perform insert, update, and delete operations.
|
|
|
|
|
Parameter values are usually provided as variable argumets or, alternatively, as an object array.
|
|
|
|
|
Parameter values are usually provided as variable arguments or, alternatively, as an object array.
|
|
|
|
|
|
|
|
|
|
The following example inserts a new entry:
|
|
|
|
|
|
|
|
|
|
@@ -2736,7 +2736,7 @@ placeholder ( `'?'`) arguments. The `NamedParameterJdbcTemplate` class wraps a
|
|
|
|
|
`JdbcTemplate` and delegates to the wrapped `JdbcTemplate` to do much of its work. This
|
|
|
|
|
section describes only those areas of the `NamedParameterJdbcTemplate` class that differ
|
|
|
|
|
from the `JdbcTemplate` itself -- namely, programming JDBC statements by using named
|
|
|
|
|
parameters. The following exampe shows how to use `NamedParameterJdbcTemplate`:
|
|
|
|
|
parameters. The following example shows how to use `NamedParameterJdbcTemplate`:
|
|
|
|
|
|
|
|
|
|
====
|
|
|
|
|
[source,java,indent=0]
|
|
|
|
|
@@ -3096,11 +3096,11 @@ The following example updates a column for a certain primary key:
|
|
|
|
|
|
|
|
|
|
In the preceding example,
|
|
|
|
|
an SQL statement has placeholders for row parameters. You can pass the parameter values
|
|
|
|
|
in as varargs or ,alternatively, as an array of objects. Thus, you should explictly wrap primitives
|
|
|
|
|
in as varargs or ,alternatively, as an array of objects. Thus, you should explicitly wrap primitives
|
|
|
|
|
in the primitive wrapper classes, or you should use auto-boxing.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[[jdbc-auto-genereted-keys]]
|
|
|
|
|
[[jdbc-auto-generated-keys]]
|
|
|
|
|
==== Retrieving Auto-generated Keys
|
|
|
|
|
|
|
|
|
|
An `update()` convenience method supports the retrieval of primary keys generated by the
|
|
|
|
|
|