|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2015 the original author or authors. |
| 2 | + * Copyright 2002-2016 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
36 | 36 | * does not have to know about annotations. If no rules are relevant to the exception,
|
37 | 37 | * it will be treated like
|
38 | 38 | * {@link org.springframework.transaction.interceptor.DefaultTransactionAttribute}
|
39 |
| - * (rolling back on runtime exceptions). |
| 39 | + * (rolling back on {@link RuntimeException} and {@link Error} but not on checked |
| 40 | + * exceptions). |
40 | 41 | *
|
41 | 42 | * <p>For specific information about the semantics of this annotation's attributes,
|
42 | 43 | * consult the {@link org.springframework.transaction.TransactionDefinition} and
|
|
102 | 103 | * <p>This just serves as a hint for the actual transaction subsystem;
|
103 | 104 | * it will <i>not necessarily</i> cause failure of write access attempts.
|
104 | 105 | * A transaction manager which cannot interpret the read-only hint will
|
105 |
| - * <i>not</i> throw an exception when asked for a read-only transaction. |
| 106 | + * <i>not</i> throw an exception when asked for a read-only transaction |
| 107 | + * but rather silently ignore the hint. |
106 | 108 | * @see org.springframework.transaction.interceptor.TransactionAttribute#isReadOnly()
|
107 | 109 | */
|
108 | 110 | boolean readOnly() default false;
|
|
111 | 113 | * Defines zero (0) or more exception {@link Class classes}, which must be
|
112 | 114 | * subclasses of {@link Throwable}, indicating which exception types must cause
|
113 | 115 | * a transaction rollback.
|
| 116 | + * <p>By default, a transaction will be rolling back on {@link RuntimeException} |
| 117 | + * and {@link Error} but not on checked exceptions (business exceptions). See |
| 118 | + * {@link org.springframework.transaction.interceptor.DefaultTransactionAttribute#rollbackOn(Throwable)} |
| 119 | + * for a detailed explanation. |
114 | 120 | * <p>This is the preferred way to construct a rollback rule (in contrast to
|
115 | 121 | * {@link #rollbackForClassName}), matching the exception class and its subclasses.
|
116 |
| - * <p>Similar to {@link org.springframework.transaction.interceptor.RollbackRuleAttribute#RollbackRuleAttribute(Class clazz)} |
| 122 | + * <p>Similar to {@link org.springframework.transaction.interceptor.RollbackRuleAttribute#RollbackRuleAttribute(Class clazz)}. |
117 | 123 | * @see #rollbackForClassName
|
| 124 | + * @see org.springframework.transaction.interceptor.DefaultTransactionAttribute#rollbackOn(Throwable) |
118 | 125 | */
|
119 | 126 | Class<? extends Throwable>[] rollbackFor() default {};
|
120 | 127 |
|
|
124 | 131 | * a transaction rollback.
|
125 | 132 | * <p>This can be a substring of a fully qualified class name, with no wildcard
|
126 | 133 | * support at present. For example, a value of {@code "ServletException"} would
|
127 |
| - * match {@link javax.servlet.ServletException} and its subclasses. |
| 134 | + * match {@code javax.servlet.ServletException} and its subclasses. |
128 | 135 | * <p><b>NB:</b> Consider carefully how specific the pattern is and whether
|
129 | 136 | * to include package information (which isn't mandatory). For example,
|
130 | 137 | * {@code "Exception"} will match nearly anything and will probably hide other
|
131 | 138 | * rules. {@code "java.lang.Exception"} would be correct if {@code "Exception"}
|
132 | 139 | * were meant to define a rule for all checked exceptions. With more unusual
|
133 | 140 | * {@link Exception} names such as {@code "BaseBusinessException"} there is no
|
134 | 141 | * need to use a FQN.
|
135 |
| - * <p>Similar to {@link org.springframework.transaction.interceptor.RollbackRuleAttribute#RollbackRuleAttribute(String exceptionName)} |
| 142 | + * <p>Similar to {@link org.springframework.transaction.interceptor.RollbackRuleAttribute#RollbackRuleAttribute(String exceptionName)}. |
136 | 143 | * @see #rollbackFor
|
| 144 | + * @see org.springframework.transaction.interceptor.DefaultTransactionAttribute#rollbackOn(Throwable) |
137 | 145 | */
|
138 | 146 | String[] rollbackForClassName() default {};
|
139 | 147 |
|
|
144 | 152 | * <p>This is the preferred way to construct a rollback rule (in contrast
|
145 | 153 | * to {@link #noRollbackForClassName}), matching the exception class and
|
146 | 154 | * its subclasses.
|
147 |
| - * <p>Similar to {@link org.springframework.transaction.interceptor.NoRollbackRuleAttribute#NoRollbackRuleAttribute(Class clazz)} |
| 155 | + * <p>Similar to {@link org.springframework.transaction.interceptor.NoRollbackRuleAttribute#NoRollbackRuleAttribute(Class clazz)}. |
148 | 156 | * @see #noRollbackForClassName
|
| 157 | + * @see org.springframework.transaction.interceptor.DefaultTransactionAttribute#rollbackOn(Throwable) |
149 | 158 | */
|
150 | 159 | Class<? extends Throwable>[] noRollbackFor() default {};
|
151 | 160 |
|
|
155 | 164 | * cause a transaction rollback.
|
156 | 165 | * <p>See the description of {@link #rollbackForClassName} for further
|
157 | 166 | * information on how the specified names are treated.
|
158 |
| - * <p>Similar to {@link org.springframework.transaction.interceptor.NoRollbackRuleAttribute#NoRollbackRuleAttribute(String exceptionName)} |
| 167 | + * <p>Similar to {@link org.springframework.transaction.interceptor.NoRollbackRuleAttribute#NoRollbackRuleAttribute(String exceptionName)}. |
159 | 168 | * @see #noRollbackFor
|
| 169 | + * @see org.springframework.transaction.interceptor.DefaultTransactionAttribute#rollbackOn(Throwable) |
160 | 170 | */
|
161 | 171 | String[] noRollbackForClassName() default {};
|
162 | 172 |
|
|
0 commit comments