Hi !!
I agree with all of you but still have a question. If my application
is divided into a few layers, say:

Web <---> BizDelegate --- <---> EJB  
                                  |__<--> DAO / server side program

My practice is catch all SQLException in DAO(s), but never throws
excepion from my DAO, all DAOs will return primitive, at least a
boolean to indicate the query is success or not
It is because there is nothing to do with the above layers when
something goes wrong in DB.

However if every method have a try -- catch block, especially in EJB
and DAO layers, it would become a speed lose. My practice is to catch
ALL kind of Exception in just BizDelegate, whenever an exception is
caught, it return some primitive to the above Web layer. Because the
data between Web and BizDelegate can be throught network, sending an
Exception would be much inefficient than just True of False.

The bottom line is, my Web layer doesn't need to know what going
wrong, it just need to know IS IT going wrong. Then forward to some
error pages, or maybe retry one more time.

But it still can't suit to all situation, some methods in BizDelegate
will thorws Exception of the type BizDelegateException. When the web
layer can do something to the exception, BizDelegate will include the
Exception thrown from under layer to the cause of
BizDelegateException, then throw up to Web layer.

Is it sounds good ??

Regards

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to