• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

Create methods throwing the unchecked exceptions...

 
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am having some basic doubt, please clarify.

Why create methods of home interface and business methods of component interface can not throw the unchecked execptions?

If create methods of home interface or business methods of component interface are throwing the unchecked exceptions, Will it give compile time error. Or Is it part of J2EE specifications??

Please clarify.....
 
cowbird
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

As a bean provider, you can and should always wrap checked exceptions that the client is not expecting (not declared in your interface) in an EJBException, and throw that EJBException. You don't have to declare the EJBException in your home or component interface. The compiler won't complain...

If your business logic encounters runtime exceptions, just let them propagate to the container.

I'm not really sure the specs allow you to declare runtime exceptions... anyone else ?

If you create your own application exceptions, they should not extend RuntimeException or RemoteException. You need to declare those application exceptions in your bean class and your home or component interface if you throw them.

Hope this helps.
 
reply
    Bookmark Topic Watch Topic
  • New Topic