Checked & Unchecked Exceptions


Checked Exceptions
  • are subclasses of java.lang.Exception
  • need to be declared in a method or constructor's throws clause

Unchecked Exceptions
  • are subclasses of java.lang.RuntimeException
  • do not need to be declared in a method or constructor's throws clause

In the context of common transaction APIs, such as JTA or Spring transaction APIs;

any RuntimeException triggers rollback, and any checked Exception does not rollback the transaction.


Runtime
Rollback
Unchecked

Yorumlar

Popular

Java 14 New Features

Pretenders, Contenders and Liars

Java 12 New Features