How should I wrap a SQLException to an unchecked one?
问题 We all know that SQLException is a checked Exception and most of us agree that checked Exception are verbose and leads 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) 回答1: 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