It's not a secret anymore!
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Clarification need for Appliation Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Clarification need for Appliation Exception" Watch "Clarification need for Appliation Exception" New topic

Clarification need for Appliation Exception

Jeya Uma

Joined: Jan 11, 2009
Posts: 3

Please clarify me on the below

can @ApplicationException apply to both checked and unchecked application exception?
If it is applicabel to only unchecked application exception, how can we set rollabck as true for checked application exception?

Amandeep Singh
Ranch Hand

Joined: Jul 17, 2008
Posts: 850
Do like this


SCJP 1.4, SCWCD 5, SCBCD 5, OCPJWSD 5,SCEA-1, Started Assignment Part 2
My blog-
Chaminda Amarasinghe
Ranch Hand

Joined: May 17, 2006
Posts: 404
Yes you can,

But understand this.

all checked exceptions (which are not system) are application exceptions implicitly (that means you no need any annotation or dd. but rollback is false. If you want to rollback you have to define explicitly using annotation or in DD).

but an unchecked exception (which are not system) is not an app exception implicitly as checked. to define an unchecked exception as app excetpion you must have to annotate or declare in DD.

Jeya Uma

Joined: Jan 11, 2009
Posts: 3
Thanks for your Clarification
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 10032

Anything that is not a System exception (or anything not a subclass of RuntimeException or RemoteException) is an ApplicationException. ApplicationExceptions by default do not rollback a transaction and you have to tell it explicitly as the above post says.

SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
I agree. Here's the link:
subject: Clarification need for Appliation Exception
It's not a secret anymore!