Hello,

I am currently using EJB3 RC3 and I have some problems with exceptions.
If my DAO throws a new Exception a remote client that should take care of that 
exception ignores it. Ignoring means that the programm does not go right into 
the catch clause. 

Here is an example:


  | 
  | public Forecast getForecastByDate(int month,int year) throws 
GenericBusinessException
  |     {
  |             StringBuffer ejbQL = new StringBuffer();
  |             
  |             try
  |             {
  |                     ejbQL.append("select f from Forecast f ");
  |                     ejbQL.append("where f.month = :paramMonth ");
  |                     ejbQL.append("and f.year = :paramYear ");
  |                     
  |                     Query query = em.createQuery(ejbQL.toString());
  |                     
  |                     query.setParameter("paramMonth",month);
  |                     query.setParameter("paramYear",year);
  |                     
  |                     return (Forecast) query.getSingleResult();
  |             }
  |             catch (RuntimeException e)
  |             {
  |                     logService.logError
  |                     (
  |                             this.getClass().getName(),
  |                             Thread.currentThread().getStackTrace(),
  |                             e.getMessage()
  |                     );
  |                     throw new GenericBusinessException(e.getMessage(), 
e.getCause());
  |             }
  |     }

My client looks like this:


  |             try
  |             {
  |                     forecast = 
forecastManager.getForecastByDate(cal.get(Calendar.MONTH) + 1, 
cal.get(Calendar.YEAR));
  |             }
  |             catch (GenericBusinessException e1)
  |             {
  | 
  |                            System.out.println("Exception should be handled 
here!");
  |             }
  | 

Did I something wrong or should I migrate to RC5 PFD?

Thanks a lot!

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3927025#3927025

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3927025


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to