X Tutup
Skip to content

Commit ab139df

Browse files
committed
added javadoc references to semantic definition of transaction attributes (SPR-7029)
1 parent a5f3d00 commit ab139df

File tree

2 files changed

+44
-37
lines changed

2 files changed

+44
-37
lines changed

org.springframework.transaction/src/main/java/org/springframework/transaction/TransactionDefinition.java

Lines changed: 25 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2006 the original author or authors.
2+
* Copyright 2002-2010 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -122,8 +122,8 @@ public interface TransactionDefinition {
122122
* Execute within a nested transaction if a current transaction exists,
123123
* behave like {@link #PROPAGATION_REQUIRED} else. There is no analogous
124124
* feature in EJB.
125-
* <p><b>NOTE:</b> Actual creation of a nested transaction will only work on specific
126-
* transaction managers. Out of the box, this only applies to the JDBC
125+
* <p><b>NOTE:</b> Actual creation of a nested transaction will only work on
126+
* specific transaction managers. Out of the box, this only applies to the JDBC
127127
* {@link org.springframework.jdbc.datasource.DataSourceTransactionManager}
128128
* when working on a JDBC 3.0 driver. Some JTA providers might support
129129
* nested transactions as well.
@@ -142,10 +142,10 @@ public interface TransactionDefinition {
142142
/**
143143
* Indicates that dirty reads, non-repeatable reads and phantom reads
144144
* can occur.
145-
* <p>This level allows a row changed by one transaction to be read by
146-
* another transaction before any changes in that row have been committed
147-
* (a "dirty read"). If any of the changes are rolled back, the second
148-
* transaction will have retrieved an invalid row.
145+
* <p>This level allows a row changed by one transaction to be read by another
146+
* transaction before any changes in that row have been committed (a "dirty read").
147+
* If any of the changes are rolled back, the second transaction will have
148+
* retrieved an invalid row.
149149
* @see java.sql.Connection#TRANSACTION_READ_UNCOMMITTED
150150
*/
151151
int ISOLATION_READ_UNCOMMITTED = Connection.TRANSACTION_READ_UNCOMMITTED;
@@ -162,25 +162,23 @@ public interface TransactionDefinition {
162162
/**
163163
* Indicates that dirty reads and non-repeatable reads are prevented;
164164
* phantom reads can occur.
165-
* <p>This level prohibits a transaction from reading a row with
166-
* uncommitted changes in it, and it also prohibits the situation
167-
* where one transaction reads a row, a second transaction alters
168-
* the row, and the first transaction rereads the row, getting
169-
* different values the second time (a "non-repeatable read").
165+
* <p>This level prohibits a transaction from reading a row with uncommitted changes
166+
* in it, and it also prohibits the situation where one transaction reads a row,
167+
* a second transaction alters the row, and the first transaction re-reads the row,
168+
* getting different values the second time (a "non-repeatable read").
170169
* @see java.sql.Connection#TRANSACTION_REPEATABLE_READ
171170
*/
172171
int ISOLATION_REPEATABLE_READ = Connection.TRANSACTION_REPEATABLE_READ;
173172

174173
/**
175174
* Indicates that dirty reads, non-repeatable reads and phantom reads
176175
* are prevented.
177-
* <p>This level includes the prohibitions in
178-
* {@link #ISOLATION_REPEATABLE_READ} and further prohibits the
179-
* situation where one transaction reads all rows that satisfy a
180-
* <code>WHERE</code> condition, a second transaction inserts a
181-
* row that satisfies that <code>WHERE</code> condition, and the
182-
* first transaction rereads for the same condition, retrieving
183-
* the additional "phantom" row in the second read.
176+
* <p>This level includes the prohibitions in {@link #ISOLATION_REPEATABLE_READ}
177+
* and further prohibits the situation where one transaction reads all rows that
178+
* satisfy a <code>WHERE</code> condition, a second transaction inserts a row
179+
* that satisfies that <code>WHERE</code> condition, and the first transaction
180+
* re-reads for the same condition, retrieving the additional "phantom" row
181+
* in the second read.
184182
* @see java.sql.Connection#TRANSACTION_SERIALIZABLE
185183
*/
186184
int ISOLATION_SERIALIZABLE = Connection.TRANSACTION_SERIALIZABLE;
@@ -209,9 +207,8 @@ public interface TransactionDefinition {
209207
* defined on {@link TransactionDefinition this interface}.
210208
* <p>Only makes sense in combination with {@link #PROPAGATION_REQUIRED}
211209
* or {@link #PROPAGATION_REQUIRES_NEW}.
212-
* <p>Note that a transaction manager that does not support custom
213-
* isolation levels will throw an exception when given any other level
214-
* than {@link #ISOLATION_DEFAULT}.
210+
* <p>Note that a transaction manager that does not support custom isolation levels
211+
* will throw an exception when given any other level than {@link #ISOLATION_DEFAULT}.
215212
* @return the isolation level
216213
*/
217214
int getIsolationLevel();
@@ -221,9 +218,8 @@ public interface TransactionDefinition {
221218
* <p>Must return a number of seconds, or {@link #TIMEOUT_DEFAULT}.
222219
* <p>Only makes sense in combination with {@link #PROPAGATION_REQUIRED}
223220
* or {@link #PROPAGATION_REQUIRES_NEW}.
224-
* <p>Note that a transaction manager that does not support timeouts
225-
* will throw an exception when given any other timeout than
226-
* {@link #TIMEOUT_DEFAULT}.
221+
* <p>Note that a transaction manager that does not support timeouts will throw
222+
* an exception when given any other timeout than {@link #TIMEOUT_DEFAULT}.
227223
* @return the transaction timeout
228224
*/
229225
int getTimeout();
@@ -237,9 +233,9 @@ public interface TransactionDefinition {
237233
* ({@link #PROPAGATION_SUPPORTS}). In the latter case, the flag will
238234
* only apply to managed resources within the application, such as a
239235
* Hibernate <code>Session</code>.
240-
* <p>This just serves as a hint for the actual transaction subsystem;
236+
<< * <p>This just serves as a hint for the actual transaction subsystem;
241237
* it will <i>not necessarily</i> cause failure of write access attempts.
242-
* A transaction manager that cannot interpret the read-only hint will
238+
* A transaction manager which cannot interpret the read-only hint will
243239
* <i>not</i> throw an exception when asked for a read-only transaction.
244240
* @return <code>true</code> if the transaction is to be optimized as read-only
245241
* @see org.springframework.transaction.support.TransactionSynchronization#beforeCommit(boolean)
@@ -251,10 +247,8 @@ public interface TransactionDefinition {
251247
* Return the name of this transaction. Can be <code>null</code>.
252248
* <p>This will be used as the transaction name to be shown in a
253249
* transaction monitor, if applicable (for example, WebLogic's).
254-
* <p>In case of Spring's declarative transactions, the exposed name
255-
* must (and will) be the
256-
* <code>fully-qualified class name + "." + method name</code>
257-
* (by default).
250+
* <p>In case of Spring's declarative transactions, the exposed name will be
251+
* the <code>fully-qualified class name + "." + method name</code> (by default).
258252
* @return the name of this transaction
259253
* @see org.springframework.transaction.interceptor.TransactionAspectSupport
260254
* @see org.springframework.transaction.support.TransactionSynchronizationManager#getCurrentTransactionName()

org.springframework.transaction/src/main/java/org/springframework/transaction/annotation/Transactional.java

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2009 the original author or authors.
2+
* Copyright 2002-2010 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -36,10 +36,15 @@
3636
* it will be treated like
3737
* {@link org.springframework.transaction.interceptor.DefaultTransactionAttribute}
3838
* (rolling back on runtime exceptions).
39-
*
39+
*
40+
* <p>For specific information about the semantics of this annotation's attributes,
41+
* consider the {@link org.springframework.transaction.TransactionDefinition} and
42+
* {@link org.springframework.transaction.interceptor.TransactionAttribute} javadocs.
43+
*
4044
* @author Colin Sampaleanu
4145
* @author Juergen Hoeller
4246
* @since 1.2
47+
* @see org.springframework.transaction.interceptor.TransactionAttribute
4348
* @see org.springframework.transaction.interceptor.DefaultTransactionAttribute
4449
* @see org.springframework.transaction.interceptor.RuleBasedTransactionAttribute
4550
*/
@@ -60,25 +65,33 @@
6065

6166
/**
6267
* The transaction propagation type.
63-
* <p>Defaults to {@link Propagation#REQUIRED}.
68+
* Defaults to {@link Propagation#REQUIRED}.
69+
* @see org.springframework.transaction.interceptor.TransactionAttribute#getPropagationBehavior()
6470
*/
6571
Propagation propagation() default Propagation.REQUIRED;
6672

6773
/**
6874
* The transaction isolation level.
69-
* <p>Defaults to {@link Isolation#DEFAULT}.
75+
* Defaults to {@link Isolation#DEFAULT}.
76+
* @see org.springframework.transaction.interceptor.TransactionAttribute#getIsolationLevel()
7077
*/
7178
Isolation isolation() default Isolation.DEFAULT;
7279

7380
/**
7481
* The timeout for this transaction.
75-
* <p>Defaults to the default timeout of the underlying transaction system.
82+
* Defaults to the default timeout of the underlying transaction system.
83+
* @see org.springframework.transaction.interceptor.TransactionAttribute#getTimeout()
7684
*/
7785
int timeout() default TransactionDefinition.TIMEOUT_DEFAULT;
7886

7987
/**
8088
* <code>true</code> if the transaction is read-only.
81-
* <p>Defaults to <code>false</code>.
89+
* Defaults to <code>false</code>.
90+
* <p>This just serves as a hint for the actual transaction subsystem;
91+
* it will <i>not necessarily</i> cause failure of write access attempts.
92+
* A transaction manager which cannot interpret the read-only hint will
93+
* <i>not</i> throw an exception when asked for a read-only transaction.
94+
* @see org.springframework.transaction.interceptor.TransactionAttribute#isReadOnly()
8295
*/
8396
boolean readOnly() default false;
8497

0 commit comments

Comments
 (0)
X Tutup