Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

should the container discards the ejb instance when an application exception thrown?

 
Helen Ge
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I need your help to clear my doubt - should the container discard the instance of EJB if a business method of that EJB throws an application exception?

It seems that I found two different answers/explanations from two different study resource:

1. From the Whizlab free mock exam question #10:

Which of the following statement is incorrect about the how the exceptions are handled in EJBs?

A. When a business method of an enterprise bean throws an application exception, the container discards that instance of the bean.

B. Message driven beans are not allowed to throw application exceptions to the client.

C. When a business method of an enterprise bean throws an application exception, the container always automatically rolls back the transaction.

D. The class of the exception received by the client is the same the class of the exception when the bean throws an application exception.


Answer: C is the correct answer.



2. From MZ's study notes: (Chapter 12):

it writes only the system exception will cause the container DISCARD the instance.


Can someone clear the cloud for me?

thanks

Helen

SCJP
SCWCD
SCDJWS
 
Michael Maier
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Helen,

I think in answer A) a systems exeception is meant.

Michael
 
Helen Ge
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael, thanks for your reply. I think it's a mistake on the Whizlab's mock exam. When I prepared my SCDJWS, I found some errors in the Whizlab mock exam too. I need to contact them for the correction.

Helen Ge

SCJP
SCWCD
SCDJWS
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic