Sivakumar,

The way I do Exception handling is:

I have custom MyProperyException class which represents a problem with any
of
many instance variables of any given Entity EJB. This problem can occur
while
values are assigned to instance vars of Ent. EJB. The problem can be wrong
type of the
value being assigned, or value assigned can be out of range, or something
else.

Also, I have MyBusinessException class which represents a problem with
relationship between
more than one different EntityEJBs. The problem can occur when a business
method is invoked, which involves more than one Entity EJBs.

Business methods are ones of a Session Bean. It is also known as wrapping
Entity EJBs with Session EJB.

MyPropertyException is declared as being "thrown" by such methods of Enity
EJB as "create" of EntEJBs
Remote interface and any methods added to this interface by developer
(a.k.a. Business Methods, even though I consider them Persistence Related
Custom Methods of Ent. EJB - I consider methods of the Session EJB to be
ultimate Business Methods.)


MyBusinessException is declared as being "thrown" by (ultimate) Business
methods of Session EJB.
Session EJB is stateless and each method represents one whole transaction.
In other words, there
is no transaction which completion requires invocation of more than one
method of Session EJB.

I do have a Servlet which plays a role of a Controller, in other words, it
mediates between View (GUI, which I implement as JSP) and Model (which is my
Session Beans - the ultimate governers of the Business Oikumen - they can
execute steps which pertain to Business Rules - and the steps they execute
are the ultimate Business Methods).

Now, imagine an attempt to enter some property values in HTML form and
submit it to Controller.
Also, lets' assume that some values are of wrong format (wrong properties,
1-WP), some are of wright format but do not make a business sense (business
problem, 2-BP).


1-WP will cause throwing of MyPropertyException by some methods of Remote
interface of Entity EJB.

We know, that Session EJB wraps Entity EJb, which means that there is a
method AA in Ses. EJB which calls method A of Ent. EJB.

Remember, A throws MyPropertException, AA does not.

AA catches MyPropertException, interprets it in terms of Business Rules and
throws appropriate MyBusinessException.

Controller catches MyBusinessException and informs GUI about it. In my case,
Controller-servlet
redirects to URL of proper JSP which visualizes MyBusinessException. Of
course, MyBusinessException instance is passed to that JSP (I use
HTTPSession object to do that). MyBusinessException instance contains my
custom info about what happend in terms of Business Rule violated.


Viktor Gritsenko,
the Generic Semantic Associations guy





----- Original Message -----
From: Sivakumar_Subramanian <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 18, 2000 8:51 AM
Subject: Exception Handling..


> Hi,
>         How do i handle my own / user-defined exception for all the
> exceptions like Create exception, Remote Exception in EJB. If so, whether
i
> need to include that exception class in all the deployable jar files? is
it
> not ringing?? pls let me know.
>
> I don't want any third party tools also.
>
> help will be greatly appreciated.
>
> with regards,
> sivakumar
>
>
===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff EJB-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
>

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to