File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
Author

Clarification need for Appliation Exception

Jeya Uma
Greenhorn

Joined: Jan 11, 2009
Posts: 3
Hi,

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?

Thanks
Uma
Amandeep Singh
Ranch Hand

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

@ApplicationException(rollback=true)


SCJP 1.4, SCWCD 5, SCBCD 5, OCPJWSD 5,SCEA-1, Started Assignment Part 2
My blog- http://rkydesigns.blogspot.com
Chaminda Amarasinghe
Ranch Hand

Joined: May 17, 2006
Posts: 402
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
Greenhorn

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

Joined: Sep 26, 2006
Posts: 9349
    
    2

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: http://aspose.com/file-tools
 
subject: Clarification need for Appliation Exception