• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Overload ejbCreate on MDB

 
phenix java
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Question From Jdiscuss

Which of the following are true regarding the implementation of an Message Driven Bean? Select 3 correct options

A The class must have, directly or indirectly, a non abstract onMessage method.
B It cannot implement ejbRemove method.
C It may implement finalize() method.
D It must implement setMessageDrivenContext() method.
E It may implement overloaded ejbCreate() methods.

Answer of ADE
****************************************************************************
From Jpilot

Which of the following are requirements for a message-driven bean. Select all 4 correct Choices.

A.It implements the MessageListener and MessageDrivenBean interfaces.
B.It implements one or more ejbCreate methods.
C.It implements one onMessageReceived method.
D.It must not define the finalize method.
E.It implements one ejbRemove method.
F.It must not have a remote or local interface.

Answer:ADEF
***************************************************************************

From 2 Question. I very suspect about overload of ejbCreate method on MBD Which it can be or can't?

Would someone please advice explain this issue on truely detail.

Thank you so much
 
Kay Ra
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to me It cannot have an overloaded create Method.
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remember that MDBs are created by the container. And the container is only interested in simply creating them. There's no additional information the container "needs" to pass to the MDB. If you want to do something special, put it into the setMessageDrivenContext function.
 
Jim Janssens
Ranch Hand
Posts: 210
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A message driven bean may have overloaded ejbCreate methods. But, you do not want to do this, it serves no use since the container will never invoke them. The spec does not say anything about this if you ask me, only that it must have atleast one ejbCreate with no arguments.

So, it will be question depended:

The first question says that there are 3 correct answers. It is clear that B and C are totally wrong no matter the circumstance. Option E is correct (it MAY do that) but it has no use. But you need 3 correct answers, so you select it.

For the second question you need 4 correct answers. C is completely wrong. D, E and F are 100% true. And so is A.
You could be doubting that answer B is true also, but if you read the question you will notice that they say it like 'It is a normal thing that an MDB implements more then one ejbCreate' . Which is not, it may do that, but you don't want to do it. So you should feel that answer B is fishy, its not really true but also not really false, while A D E and F are 100% true and C is 100% false. So your answers should be A D E and F.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic