|
|
|
@ -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] |
|
|
|
[source,java,indent=0] |
|
|
|
@ -1004,7 +1004,7 @@ transactional settings: |
|
|
|
[[transaction-declarative-txadvice-settings]] |
|
|
|
[[transaction-declarative-txadvice-settings]] |
|
|
|
==== <tx:advice/> 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:advice/>` tag. The default `<tx:advice/>` settings are: |
|
|
|
|
|
|
|
|
|
|
|
* The <<tx-propagation,propagation setting>> is `REQUIRED.` |
|
|
|
* The <<tx-propagation,propagation setting>> is `REQUIRED.` |
|
|
|
@ -1314,15 +1314,15 @@ properties of the `@Transactional` annotation: |
|
|
|
|
|
|
|
|
|
|
|
| `isolation` |
|
|
|
| `isolation` |
|
|
|
| `enum`: `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` |
|
|
|
| `timeout` |
|
|
|
| `int` (in seconds of granularity) |
|
|
|
| `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` |
|
|
|
| `readOnly` |
|
|
|
| `boolean` |
|
|
|
| `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` |
|
|
|
| `rollbackFor` |
|
|
|
| Array of `Class` objects, which must be derived from `Throwable.` |
|
|
|
| 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]] |
|
|
|
[[transaction-solutions-to-common-problems]] |
|
|
|
=== 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]] |
|
|
|
[[transaction-solutions-to-common-problems-wrong-ptm]] |
|
|
|
@ -2375,7 +2375,7 @@ including error handling. It includes the following topics: |
|
|
|
* <<jdbc-statements-executing>> |
|
|
|
* <<jdbc-statements-executing>> |
|
|
|
* <<jdbc-statements-querying>> |
|
|
|
* <<jdbc-statements-querying>> |
|
|
|
* <<jdbc-updates>> |
|
|
|
* <<jdbc-updates>> |
|
|
|
* <<jdbc-auto-genereted-keys>> |
|
|
|
* <<jdbc-auto-generated-keys>> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[[jdbc-JdbcTemplate]] |
|
|
|
[[jdbc-JdbcTemplate]] |
|
|
|
@ -2522,7 +2522,7 @@ preceding code snippet as follows: |
|
|
|
===== Updating (`INSERT`, `UPDATE`, and `DELETE`) with `JdbcTemplate` |
|
|
|
===== Updating (`INSERT`, `UPDATE`, and `DELETE`) with `JdbcTemplate` |
|
|
|
|
|
|
|
|
|
|
|
You can use the `update(..)` method to perform insert, update, and delete operations. |
|
|
|
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: |
|
|
|
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 |
|
|
|
`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 |
|
|
|
section describes only those areas of the `NamedParameterJdbcTemplate` class that differ |
|
|
|
from the `JdbcTemplate` itself -- namely, programming JDBC statements by using named |
|
|
|
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] |
|
|
|
[source,java,indent=0] |
|
|
|
@ -3096,11 +3096,11 @@ The following example updates a column for a certain primary key: |
|
|
|
|
|
|
|
|
|
|
|
In the preceding example, |
|
|
|
In the preceding example, |
|
|
|
an SQL statement has placeholders for row parameters. You can pass the parameter values |
|
|
|
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. |
|
|
|
in the primitive wrapper classes, or you should use auto-boxing. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[[jdbc-auto-genereted-keys]] |
|
|
|
[[jdbc-auto-generated-keys]] |
|
|
|
==== Retrieving Auto-generated Keys |
|
|
|
==== Retrieving Auto-generated Keys |
|
|
|
|
|
|
|
|
|
|
|
An `update()` convenience method supports the retrieval of primary keys generated by the |
|
|
|
An `update()` convenience method supports the retrieval of primary keys generated by the |
|
|
|
|