This week's giveaway is in the Spring forum.
We're giving away four copies of Microservices Testing (Live Project) and have Chris Love & Andres Sacco on-line!
See this thread for details.
Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • 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
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Application Exception or Runtime Exception

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All

While designing our current application (using EJB) we have decided to have a
few Business case exception

I am new to EJB & was going through the container's way of handling exception & found that
in case of CMT the container will rollback the Runtime Exceptions

Would it be a good idea to make all our business case exceptions extend to the Runtime Excpetion.

Are there any perils of this approach

Kindly ellaborate on the same


Rgrds
Mahesh
 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
if u make all UR biz exce..n a type of RuntimeExce..n, how will the client knows vat hav hapend?not onli contaner simpli remove the instance without calling ejbRemove()(in the case stateful session bean).this wil cause scalability issues.
u dont need to du that. u can handle such scenario by creating/throwing Application exce..n and then u call setRollbackOnly() in ejb context.
the txn will never committed in this case.
binoj v
 
Ranch Hand
Posts: 351
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are standard approaches for handling exceptions in EJB. I recommend reading the exceptions chapter in some good book. Knowing how to go about it will surely help you. It is not as simple as saying do this and do that. You need to know 'when and why' also.

Regards,
Leena
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic