• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Create methods throwing the unchecked exceptions...

 
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic