# @Transactional rollback rule
###### tags: `spring`,`transaction`,`rollback`
only unchecked exception will trigger rollback in default.
According to Spring documentation:
>In its default configuration, the Spring Frameworkâs transaction infrastructure code marks a transaction for rollback only in the case of runtime, unchecked exceptions. That is, when the thrown exception is an instance or subclass of `RuntimeException`. ( `Error` instances also, by default, result in a rollback). Checked exceptions that are thrown from a transactional method do not result in rollback in the default configuration.

<font color="green">
<h3>
unchecked exception(runtime exception)
</h3>
1. runtimeException::non-checked excetion => trigger rollback, in class declaration, you dont need add throws exception and compile successes.<br>
2. java dont check these exception during compile.</font>
<br>
<font color="red">
<h3>
checked exception
</h3>
1.other exception not in runtimeexception::checked exception => non-trigger rollback by default,
in class declaration, you <b>need</b> add throws exception and compile successes.<br>
2. java check these exception during compile.</font>
3. isn't required to be handled(no throw in method signature)
if want to rollback for all exception in transaction:
```java=
@Transactional(rollbackFor = Exception.class)
```