Page 1 of 1

About Question enthuware.oce-ejbd.v6.2.454 :

Posted: Tue May 03, 2011 3:02 am
by deadlock_gr
This is not an error, but a minor suggestion. The dialog says to create a valid EJB 3.0 exception. I would change that to EJB 3.x, but this is personal taste.

Re: About Question enthuware.oce-ejbd.v6.2.454 :

Posted: Tue May 03, 2011 5:53 am
by admin
You are right. This has been updated.

Thanks for the suggestion!

Re: About Question enthuware.oce-ejbd.v6.2.454 :

Posted: Wed Aug 14, 2013 8:22 am
by kdmandawe
Hi would this be valid as a correct answer?

Code: Select all

@ApplicationException
public class MyException extends EJBException
Take note I'm using EJBException instead of RuntimeException.
Since EJBException extends RuntimeException, I believe this is valid. Please correct me if I'm wrong.

Thanks,
Kenneth

Re: About Question enthuware.oce-ejbd.v6.2.454 :

Posted: Wed Aug 14, 2013 8:57 am
by kezman9
Yes, it is valid
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.
EJBException is a RuntimeException so you can annotate it with @ApplicationException. In Java langauge it is called "is a" relationship. The other one is "has a" one.

For example
http://en.wikipedia.org/wiki/Is-a#Java
http://www.tutorialspoint.com/java/java_inheritance.htm

J

Re: About Question enthuware.oce-ejbd.v6.2.454 :

Posted: Wed Aug 14, 2013 9:02 am
by kdmandawe
If that's valid, then that's another alternative to the DnD question. Just to clarify since there is also 'EJBException' among the choices. It was not indicated there that there are more than one correct answers.

Re: About Question enthuware.oce-ejbd.v6.2.454 :

Posted: Wed Aug 14, 2013 9:13 am
by kezman9
Yes, it seems like it is valid option. But for me annotating EJBException as application exceptions looks awkward at least;-) I'm curious what Paul thinks about it.

J

Re: About Question enthuware.oce-ejbd.v6.2.454 :

Posted: Wed Aug 14, 2013 9:24 am
by kdmandawe
The DnD question says: "Create a valid EJB 3.x application exception that is a runtime exception."

EJBException IS-A RuntimeException, therefore that's(my code snippet above) still an application exception which is a runtime exception.

Re: About Question enthuware.oce-ejbd.v6.2.454 :

Posted: Wed Aug 14, 2013 11:50 am
by admin
You are right. EJBException should also be a valid choice. It has now been added as a valid choice.

thank you for your feedback!