• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Mock exam questions on MDB (2)

 
Cowgirl and Author
Posts: 1589
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, a couple of easy ones
==========================
Which two are true about message-driven beans? (Choose two.)
A) Message-driven beans do not expose a client view.
B) Message-driven beans must implement the JMSListener interface.
C) Message-driven beans cannot throw application exceptions.
D) Message-driven beans must not use bean-managed transaction demarcation.
E) Message-driven beans can use the getCallerPrincipal() method of MessageDrivenContext.
====================================
Which transaction attributes can be specified for a message-driven bean? (Check all that apply, from none to all)
A) Required
B) RequiresNew
C) Supports
D) NotSupported
E) Mandatory
F) Never
[Don't freak out over the 'check all that apply' thing. The real exam DOES tell you how many to choose. But I have to make it a little harder here so that you'll think about it more... ]
cheers,
Kathy

"Nothing is too wonderful to be true..."
-Michael Faraday
 
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which two are true about message-driven beans? (Choose two.)
A) Message-driven beans do not expose a client view.
B) Message-driven beans must implement the JMSListener interface.
C) Message-driven beans cannot throw application exceptions.
D) Message-driven beans must not use bean-managed transaction demarcation.
E) Message-driven beans can use the getCallerPrincipal() method of MessageDrivenContext.

Dear Kathy,
To my knowledge the correct answers are: A and C!
A) True: because MDB is not intended to be accessible to the client and has no APIs for client.
B) MDB must implement the javax.ejb.MessageListener and MessageDrivenBean interfaces and not a JMSListener.
C) True: No application exceptions should be thrown from onMessage() method of MDB.
Only container can throw system exceptions from MDB methods.
D) IllegalStateException will be thrown by the container if this method is called because MBD
methods are called by the container and do not run in a security context.
Please correct me if I am wrong!
Thank you!
Seid
 
Seid Myadiyev
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which transaction attributes can be specified for a message-driven bean? (Check all that apply, from none to all)
A) Required
B) RequiresNew
C) Supports
D) NotSupported
E) Mandatory
F) Never
In this questions only A and B are correct answers!
Please correct me if I am wrong.
Thanks,
Seid
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Kathy Sierra:
Which transaction attributes can be specified for a message-driven bean? (Check all that apply, from none to all)
A) Required
B) RequiresNew
C) Supports
D) NotSupported
E) Mandatory
F) Never


AFAIK A and D are the correct Answers
Dragan
 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
True, Dragan, A and D are the answers.
B) RequiresNew
Does not make sense as the transaction context is not propagated from the client (there's no client view at all), so no previous transaction to suspend by this attribute value.
C) Supports
When we state this attribute, the caller's transaction context will determine the behaviour. We will either run w/o a transaction (if the caller didn't have one) or join a transaction (if the caller had one). For the reasons stated above, this is always equal to NotSupported TX attribute in case of MDB.
E) Mandatory
Again, no client view, no client transaction presence to check and enforce.
F) Never
For merely the same reason as in E.
P.S.: I really find it a fruitful learning to not only choose the right answer, but explain why you didn't choose the others as well. Is it of any help to you, ranchers?
 
Seid Myadiyev
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Andrew, you are right about explanations!
I took time to explain my answers to the first question but not to the second one.
(To my embarrassment I meant "Required" and "NotSupported" but I mistakenly chose B instead of D. Had I taken time to justify my choices my mistake would have been evident in addition to explanations to readers. Sorry about that.)

Thank you very much for the advice and corrections, Dragan and Andrew!
+Seid
[ May 23, 2003: Message edited by: Seid Myadiyev ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic