We all know that SQLException
is a checked Exception
and most of us agree that checked exceptions are verbose and lead to throw/catch pollution.
Which approach should I choose to avoid SQLException throwing?
Which wrapper/technique/library is recommended?
(for example DataAccessException
for the Spring folks, but I don't want to use Spring)
Just wrap it as new RuntimeException(jdbce)
. Or defince your own exception that extends runtime exception and use it. I do not think that any framework is required here. Even spring wraps checked exceptions by unchecked every time it needs it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With