Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JBoss User »

[JBoss-user] exception handling advice

Brian McSweeney

2003-09-10

Replies:

Hi all,

 

I’d like to know what the best practice on handling exceptions is.

I’m using:

 

 

Jsps ---->struts actions  ----> session facades ----> entity beans

 

Imagine for a second that the session façade allows CRUD operations on

my entity beans. For example say I have a entity bean called customer.

 

Now if I try to create a customer using a session façade method should I

Throw a CreateException back to the struts action so I can tell the client

I couldn’t create the customer?

 

I have read that both FinderExceptions and CreateExceptions in session

Facades should just log it and throw new EJBException

 

[ http://www-106.ibm.com/developerworks/java/library/j-ejbexcept.html ]

 

but how can you give a meaningful error back to the client as to what

happened? So should I catch finder and create exceptions in the struts

actions?

 

I’m very confused. Perhaps someone can give me some advice

Thanks,

Brian

 

©2008 junlu.com - Jax Systems, LLC, U.S.A.