I dont understand logistics of wrapping any exception into a ServletException. Doesnt it violate polymorphism rules? How can the SQLException be wrapped into a ServletException when both are subclasses of Exception class? Thanks,
You will find that the relationship is "has-a", not "is-a" in this case. The ServletException "has-a" SQLException wrapped up in a payload to be delivered by the ServletException when it is caught.
Got it. The word 'wrapping' confused me, i guess. We pass SQLException object to a Throwable reference in ServletException constructor and getRootcause() just returns tht passed object. Thanks,
SCJP 1.4
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.