Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Is that RuntimeException subclasses are system Exceptions or application exception.

 
Ranch Hand
Posts: 109
Netbeans IDE Oracle Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the Enterprise JavaBeans 3.0, Final Release specifications page 356 it says

“An application exception may be a subclass (direct or indirect) of java.lang.Exception (i.e., a “checked exception”), or an application exception class may be defined as a subclass of the java.lang.RuntimeException (an “unchecked exception”).”



And in page 357 it says

“A system exception is an exception that is a java.rmi.RemoteException (or one of its subclasses) or a RuntimeException that is not an application exception.”



I can’t understand what will happen to the transaction if we throw RuntimeException in a bean method. Is that transaction get rollback or ?
 
Creator of Enthuware JWS+ V6
Posts: 3343
303
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, all the RuntimeExceptions not annotated as an ApplicationException will cause a Rollback

Regards,
Frits
 
Ranch Hand
Posts: 459
Scala jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as I understand it, a RuntimeException is a system exception and will therefore cause a transaction to be rolled back UNLESS it is annotated with @ApplicationException, you can also cause the application exception to rollback the transaction if you add @ApplicationException(rollback=true), the default is rollback=false.
 
Udara Amarasinghe
Ranch Hand
Posts: 109
Netbeans IDE Oracle Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yeah friends thank you very much
that's correct I found it on the specification too ..
 
Udara Amarasinghe
Ranch Hand
Posts: 109
Netbeans IDE Oracle Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is that we can declare to throw subclasses of java.rmi.RemoteException directly from business interface method throws clause without wrap it with EJBException.
 
Will Myers
Ranch Hand
Posts: 459
Scala jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think you can...not sure why you would want to either
 
I'm thinking about a new battle cry. Maybe "Not in the face! Not in the face!" Any thoughts tiny ad?
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic